我的第二个URL重定向失败,当我按以下URL时服务器发出500 Internal Server Error:example.com/services/SV0087
,但是第一个重定向有效:example.com/items/I5402
。
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Indexes
RewriteEngine on
RewriteOptions inherit
AddType text/x-component .htc
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
####### this works seamlessly
RewriteRule ^items/([^/]*)$ /items/index.asp?itemcode=$1 [L]
-这会导致500个内部服务器错误
RewriteRule ^services/([^/]*)$ /services/index.asp?servicecode=$1 [L]
-当我执行$ _GET ['servicecode']
时,它将接收index.asp的值RewriteRule ^services/([^/]*)$ services/index.asp?servicecode=$1 [L]
答案 0 :(得分:1)
我必须分别为两个URL编写完整的条件代码,然后它才起作用:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^items/([^/]*)$ /items/index.asp?itemcode=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^services/([^/]*)$ /services/index.asp?servicecode=$1 [L]