簡體   English   中英

mod_rewrite RewriteRule的重定向循環錯誤

[英]Redirect loop error for mod_rewrite RewriteRule

我正在嘗試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]

但是,我收到此錯誤:
此網頁有重定向循環

嘗試這個

Options +FollowSymLinks
RewriteEngine On

# /edit/title_here/123 -> edit.php?title=title_here&user_id=123
RewriteRule ^edit/([A-Za-z0-9_]+)/([0-9]+)$ edit.php?title=$1&user_id=$2 [NC,L]

#Reroute through index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([A-Za-z0-9_]+) index.php?title=$1 [NC,L]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM