重写条件捕获(如果 URI 不以此开头)



所以我在.htaccess文件的底部有这个重写条件作为一个catchall。效果很好,但我希望它忽略任何请求,并以"/index.cfm"开头

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule (.+) /index.cfm?event=baduri&uri=$1 

所以/index.cfm?fddssds不会被触碰

但是将重定向/gdfgdfdgf。。

你能试试这个并告诉我吗:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/index.cfm
RewriteRule (.+) /index.cfm?event=baduri&uri=$1 [L,NC]

使用RewriteCond指令检查URL路径是否以/index.cfm 开头

RewriteCond %{REQUEST_URI} !^/index.cfm
RewriteRule (.+) /index.cfm?event=baduri&uri=$1 

请参阅此问题:在.htaccess中重写引擎以捕获未以html 结尾的文件

最新更新