index.php?action=affiliate/registration
/affiliate/registration/
我想重写这个 URL,index.php?action=notfound
因为affiliate/registration
在 URL 的任何部分都发现了子字符串。
答案1
我会做类似的事情:
# Don't rewrite if the request is for a real file or directory
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*)(affiliate|registration)+(.*) index.php?action=notfound [QSA,L]
如果总有一个/
之前,我宁愿这样做:
# Don't rewrite if the request is for a real file or directory
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*)/(affiliate|registration)+(.*) index.php?action=notfound [QSA,L]
如果总有一个/
之后,我宁愿这样做:
# Don't rewrite if the request is for a real file or directory
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*)(affiliate|registration)+/(.*) index.php?action=notfound [QSA,L]
如果总有/
前后之分,我宁愿这样做:
# Don't rewrite if the request is for a real file or directory
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*)/(affiliate|registration)+/(.*) index.php?action=notfound [QSA,L]