[英]apache mod_rewrite 500 internal error
I am trying to change 我正在尝试改变
http://localhost/inbox?pg=2
to http://localhost/inbox?pg=2
到
http://localhost/inobox/2
and I got a working code as below 我得到了如下的工作代码
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]
however if I change http://localhost/inbox/2
to 但是如果我将
http://localhost/inbox/2
更改为
http://localhost/inbox/2.5
or http://localhost/inbox/
I get 500 error and I am not able to figure out what is causing it. http://localhost/inbox/2.5
或http://localhost/inbox/
我收到500错误,但我不知道是什么原因引起的。 I am already checking on the php end for empty var or non numeric value however, this 500 error kicks in everytime I change it as above, does anyone know how can I redirect back to inbox.php if one of these situations happen? 我已经在php端检查空var或非数字值,但是,每次按上述方式更改它时,都会出现此500错误,有人知道如果发生这些情况之一,如何重定向回inbox.php?
log file reads r->uri = /inbox/2.5.php.php.php.php.php.php.php.php.php.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
In RewriteRule ^/?inbox/(\\d+)$ /inbox?pg=$1 [QSD,L]
the \\d
matches only numeric characters 0-9 and not the .
在
RewriteRule ^/?inbox/(\\d+)$ /inbox?pg=$1 [QSD,L]
, \\d
仅匹配数字字符0-9,而不匹配.
, so 2.5 does not match this rule. ,因此2.5与该规则不匹配。 To match both 2 and 2.5, use
([\\d.]+)
instead. 要同时匹配2和2.5,请改用
([\\d.]+)
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.