开发者

why this configuration of mod_rewrite and .htaccess on localhost on Windows doesn't work?

I'm developing a PHP website, it runs on localhost on an Apache 2.2 and Windows 7.

In my httpd.conf I've enabled mod_rewrite module开发者_开发技巧:

LoadModule rewrite_module modules/mod_rewrite.so

I've a document root located in D:\MyWeb and website I'm working on is in D:\MyWeb\simple_cms

For testing purposes, I've placed .htaccess file in D:\MyWeb\simple_cms and here is it's content:

Options +FollowSymlinks

RewriteEngine on
RewriteRule ^(.*)\.htm$ $1.php [NC]

Now, calling for http://127.0.0.1/simple_cms/index.htm should "redirect" to http://127.0.0.1/simple_cms/index.php but it displays "404 Not Found Error" (of course index.php exists there)

In access.log there is:

127.0.0.1 - - [15/Jul/2011:14:16:15 +0200] "GET /simple_cms/index.htm HTTP/1.1" 404 218

and inside error.log:

[Fri Jul 15 14:19:30 2011] [error] [client 127.0.0.1] File does not exist: D:/MyWeb/simple_cms/index.htm

Why this doesn't work? is this regular expression invalid?


  1. Make sure that .htaccess files are enabled (put AllowOverride All in appropriate place).

  2. If nothing -- please enable rewrite debugging (RewriteLogLevel 9) and check rewrite log.


Did you restart apache after you made changes to httpd.conf? It doesn't take new settings in use unless you do that.

Also did you uncomment following line in httpd.conf (in case it exists):
AddModule mod_rewrite.c

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜