3
我在使用.htaccess文件重定向URL時遇到問題。這就是我的.htaccess文件看起來像:.htaccess中的重定向規則將我帶到錯誤的地方
Redirect 301 /file-name/example.php http://www.mysite.com/file-name/example-001.php
Redirect 301 /section-name/example.php http://www.my-site.com/section-name/example-002.php
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.mysite.com$ [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)/(.*)$ hqtemplates/articles.php?file_name=$2 [L]
php_value session.use_only_cookies 1
php_value session.use_trans_sid 0
現在的問題是,當我轉到頁:www.my-site.com/file-name/example.php
,而不是重定向我www.my-site.com/file-name/example-001.php
它重定向我 www.my-site.com/file-name/example.php?file_name=example-001.php
。
出於某種原因,它將「?file_name = example-001.php」添加到網址。有誰知道這是爲什麼發生,以及如何解決它?
真棒!謝謝歐文。應該已經看到了。 :P – ocergynohtna 2008-11-12 23:53:29