0
我試圖mod_rewrite的:
重定向循環錯誤
localhost/edit.php?title=?&user_id=?
要:
localhost/edit/<?php echo $title.'/'.$user_id; ?>
所以,我可以輸出鏈接作爲一個循環
echo '<a href="localhost/edit/'.$title.'/'.$user_id.'">'.$title.'</a>';
我正在使用:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#Reroute through index.php
RewriteRule ^([a-zA-Z0-9_]+) index.php?title=$1 [NC]
#this is RewriteRule for edit.php UPDATED:
RewriteRule ^/?edit/([a-zA-Z0-9_]+)/([0-9]+)$ edit/index.php?title=$1&user_id=$2 [NC,L]
不過,我得到這個錯誤:
此網頁有重定向循環
是有唯一的規則?你有沒有目錄結構'edit/A-Za-z0-9 _ +/0-9 +'? – Shef
是的。 RewriteRule ^([a-zA-Z0-9 _] +)index.php?title = $ 1 [NC]。這是通過index.php重定向頁面。 – Graham
請發佈htaccess的所有內容,在不瞭解所有這些規則的情況下調試重寫規則並不容易,尤其是它們的順序。 – Shef