2011-12-22 48 views
0

我正在測試本地主機上的.htaccess配置。
網站的根是http://localhost/test/使用本地主機的URL重寫不起作用

我的.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重寫已啓用,適用於simplier例子

回答

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> 
+0

它在和工程等案例 – Oliver 2011-12-22 10:34:27

+0

你如何嘗試像這樣: 選項+關注聯繫人 RewriteEngine DirectoryIndex index2.php – Fredy 2011-12-23 02:48:40