Open Apache mod_rewrite Module sample code _linux

Source: Internet
Author: User
Tags documentation
Enable Mod_rewrite module
Found in the httpd.conf file in the Conf directory
LoadModule Rewrite_module modules/mod_rewrite.so
Remove the # in front of this line.
2. Enable the Options followsymlinks and allowoverride all in directories to support URL Rewirte
alias/php "c:/web/php/"
Copy Code code as follows:

<directory "c:/web/php/" >
Options Indexes FollowSymLinks
AllowOverride All
Order Allow,deny
Allow from all
</Directory>

When this is accessed through http://localhost:8080/php/, the/php/and the subdirectories underneath it will support URL rewrite.

PostScript: php100.com
Many articles on the Web do not mention using Options followsymlinks, because in httpd.conf there are
Copy Code code as follows:

<directory/>
Options FollowSymLinks
AllowOverride None
Order Deny,allow
Deny from all
Satisfy All
</Directory>

This way, if your site is configured to be accessed through http://localhost:8080/, you will not notice the effect of the options followsymlinks, just change allowoverride none to allowoverride All can be. And I am accustomed to in this machine configuration into http://localhost:8080/php/, forget to add options Indexes FollowSymLinks will not succeed, would show
Forbidden
You don ' t have permission to access/php/f2blog/on this server.
Such a mistake. Later, I found the reason in the Apache document.
Note:to enable the rewriting engine for per-directory configuration files you need to set ' "Rewriteengine on" in these F Iles and ' Options followsymlinks ' must be enabled. If your administrator has disabled override of FollowSymLinks for a user's directory, then you cannot use the rewriting EN Gine. This restriction is needed to security reasons.
In fact, Mod_rewrite is directory-specific, so it is not necessary to change all allowoverride in httpd.conf to allowoverride all,options.
BTW: It seems to be the first to look at the documentation provided by the program, but I almost read the documentation for TOMCAT5.0.28, and I don't see whether it's possible to install successful services through Service.bat on Windows. But see n many people and I have the same doubt but no answer, well, I certainly know that through Tomcatxx.exe can install the successful Tomcat service, it seems that this is the only way.

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.