Using the Apache module Rewrite_module (RPM) _php tips

Source: Internet
Author: User
Put
[url]http://wwww.aaaaaaaaa.com/...
Change the address form to
[url]http://wwww.aaaaaaaaa.com/...
Or
[url]http://wwww.aaaaaaaaa.com/...
Of course you can change as you ask.
Apache's Mod_rewrite module.
You can see a demo of a PHP learning forum
[url]http://www.phpx.com/happy/...
This forum layout and posts, is the use of this technology, address static. But it's fake.
What's the best technology?
Can let Baidu, Google and other revenue of your site all pages.
The income address is your fake static address. Of course, no one can see that you are a fake. And this technology hides the programs you carry behind your back.
You can put
/soft/1234.html rewrite passed to soft.php?id=1234
Of course you change your name to softxfewafew.php?id=1234.
The surface is still soft/1234.html but you have executed your rewritten files inside Apache.
Can fundamentally prevent others from invading from the program itself.

Below I write how to rewrite. Divided into windows and LIUNX2 species
It's all operational.
The httpd.conf in the Conf folder within the Apache installation folder
After opening, find
#LoadModule rewrite_module "Modules/mod_rewrite.so"
Get rid of the #.
Then locate the virtual host configuration
Joining in a virtual host
Rewriteengine on
Rewriterule ^/soft/([0-9]+). html$/soft.php?id=$1
Explain
WWW. Corn. com/soft/1234.html
Rewrite to
WWW. Corn. com/soft.php?id=1234
Here ID can be changed you give it 1 is passing 1
Rewriterule ^/([0-9]+). html$/soft.php?id=$1
Explain
WWW. Corn. com/1234.html
Rewrite to
WWW. Corn. com/soft.php?id=1234
Rewriterule ^/([0-9]+) _ ([0-9]+). html$/soft.php?id=$1&catid=$2
Explain
WWW. Corn. com/1234_2222.html
Rewrite to
WWW. Corn. com/soft.php?id=1234&catid=2222
Of course, whatever you want to change!
This is the win.
Liunx is the same, but it needs to be added.
<ifmodule mod_rewrite.c> Start
</IfModule> End
Overrides are added to the virtual host settings.
If there is no virtual host, that added in the end!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.