![](/img/trans.png)
[英]500 Internal Server Error CodeIgniter htaccess mod_rewrite
[英]apache mod_rewrite 500 internal error
我正在嘗試改變
http://localhost/inbox?pg=2
到
http://localhost/inobox/2
我得到了如下的工作代碼
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteRule ^/?inbox/(\d+)$ /inbox?pg=$1 [QSD,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [QSA,L]
但是如果我將http://localhost/inbox/2
更改為
http://localhost/inbox/2.5
或http://localhost/inbox/
我收到500錯誤,但我不知道是什么原因引起的。 我已經在php端檢查空var或非數字值,但是,每次按上述方式更改它時,都會出現此500錯誤,有人知道如果發生這些情況之一,如何重定向回inbox.php?
日志文件讀取為r->uri = /inbox/2.5.php.php.php.php.php.php.php.php.php.php
redirected from r->uri = /inbox/2.5.php.php.php.php.php.php.php.php.php
在RewriteRule ^/?inbox/(\\d+)$ /inbox?pg=$1 [QSD,L]
, \\d
僅匹配數字字符0-9,而不匹配.
,因此2.5與該規則不匹配。 要同時匹配2和2.5,請改用([\\d.]+)
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.