jco*_*ahd 46 apache mod-rewrite
如果URL 与"论坛"路径不匹配,我该如何执行规则?
例如:
RewriteCond IF URL IS NOT forums
RewriteRule !\.(js|gif|css|jpg|png)$ %{DOCUMENT_ROOT}/index.php [L]
Run Code Online (Sandbox Code Playgroud)
mar*_*pet 73
Apache RewriteCond
和RewriteRule
指令支持感叹号指定不匹配的模式:
您可以在模式字符串前加上'!' 字符(感叹号)指定不匹配的模式.
这应该工作:
RewriteCond %{REQUEST_URI} !^/forums.*
RewriteRule !\.(js|gif|css|jpg|png)$ /index.php [L]
Run Code Online (Sandbox Code Playgroud)
- >重定向所有不以论坛开头的请求,而不是以列出的内容结尾到index.php