2015-03-02 49 views
1

我想創建一個重寫規則,使mod_rewrite的AH00124錯誤

http://domain.ext/truc.php?id=value 

將映射到

http://domain.ext/value 

,所以我寫了這個規則在.htaccess:

RewriteEngine On 
RewriteRule ^([^/]*)$ /truc.php?id=$1 [L] 

但是,給出了永久性的500錯誤。

日誌告訴本:

AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace. 

任何人的幫助,請:) ManyThx

蒂埃裏

回答

0

是的,有一個無限循環在這裏,因爲你的規則不斷路由到/p.php。使用RewriteCond來防止它:

RewriteEngine On 
RewriteBase/

# If the request is not for a valid directory 
RewriteCond %{REQUEST_FILENAME} !-d 
# If the request is not for a valid file 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^([^/]+)$ p.php?linkID=$1 [L,QSA] 
+1

它的工作原理!你真了不起:-)非常感謝 – Thierry 2015-03-02 07:05:13