使用localhost进行URL重写无效

时间:2011-12-22 09:58:39

标签: http .htaccess mod-rewrite url-rewriting dns

我在本地主机上测试.htaccess配置 网站的根目录是http://localhost/test/

我的.htaccess是:

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/test/index2.php
RewriteRule ^test/(.*)$ /test/index2.php?dest=$1 [L]

我无法实现将http://localhost/test/开始的任何调用重定向到index2.php 使用.htaccess,然后调用http://localhost/test/index.php
我有404找不到错误“在此服务器上找不到请求的URL /test/index.php。”。

我正等着它拨打http://localhost/test/index2.php?index.php

提示:删除RewriteCond不会改变任何内容

PS:启用了URL重写,适用于更简单的示例

1 个答案:

答案 0 :(得分:0)

也许你没有启用 mod_rewrite modul。

尝试检查:AppServ\apache\conf\httpd.conf

确保此行没有前面的#符号

LoadModule rewrite_module modules/mod_rewrite.so

这一行是这样的:

<Directory "C:/AppServ/www/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>