繁体   English   中英

使用localhost的URL重写不起作用

[英]URL rewriting using localhost is not working

我正在本地主机上测试.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重写已启用,适用于简单示例

也许您尚未启用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>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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