[英]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.