简体   繁体   中英

Why RewriteRule in .htaccess does not have effect?

Apache web server is running under Windows 7 professional. Apache version is Apache/2.2.17 (Win32) PHP/5.3.8. mod_rewrite is loaded according to phpinfo() . <VirtualHost> tag contains RewriteLog and RewriteLogLevel 3 directives. Log file set in RewriteLog directive is created.

.htaccess file in root directory is following:

RewriteEngine  On
RewriteRule ^alice\.html$ bob.html

Current directory contains bob.html file and it can be opened with localhost URL.

But alice.html URL can not be opened, it causes error 404.

Log file for this site contains just normal message about file not found.

Rewrite log file exists but empty.

Which can cause rewrite directives being ignored?

Make sure you have this line in your httpd.conf:

AllowOverride All

AllowOverride controls what directives may be placed in .htaccess files.

Testing: To test whether .htaccess is enabled or not, just put some junk text in it and see if it generated a 500 internal error or not.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM