Apache Open URL Rewrite module

Source: Internet
Author: User

After the server data transfer to the local server, the local open home page appeared layout disorder and other issues, after the great God pointed out that the URL rewrite problem.

This article mainly writes about how to open the URL rewrite function of Apache.

Open apache2\conf\httpd.conf
Search Loadmodulerewrite_module modules/mod_rewrite.so (Apache2 is this)
Get rid of the front #

Search Allowoverridenone replaced by Allowoverrideall

There are several that have found something similar to the following code.

</IfModule>

#
# "D:\usr\local\Apache2\cgi-bin" should is changed to whatever your scriptaliased
# CGI Directory exists, if you have thatconfigured.
#
<directory "D:\usr\local\Apache2\cgi-bin" >
AllowOverride All
Options None
Order Allow,deny
Allow from all
</Directory>

Two add in apache2\conf\httpd.conf last line

<ifmodule mod_rewrite.c>
Rewriteengine on
Rewriterule ^ (. *)-htm-(. *) $ $1.php?$2
</IfModule>

If you do not add the above content in the apache2\conf\httpd.conf file, you can create a. htaccess file in the site directory after you write to the file

Rewriteengineon
Rewriterule ^ (. *)-htm-(. *) $ $1.php?$2

The Apache module is now open for completion. Visit the local home page again for success.

For a detailed URL rewrite configuration please see my related article.

Apache Open URL Rewrite module

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.