所以我在.htaccess文件的底部有一个重写条件作为catchall。效果很好,但我希望它忽略任何请求,并以“/index.cfm”开头
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.+) /index.cfm?event=baduri&uri=$1
所以不会触及/index.cfm?fddssds
但/ gdfgdfgdfdgf会被重定向..
答案 0 :(得分:16)
你可以尝试一下,让我知道:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/index.cfm
RewriteRule (.+) /index.cfm?event=baduri&uri=$1 [L,NC]
答案 1 :(得分:0)
使用RewriteCond指令检查URL路径是否不以/index.cfm开头
RewriteCond %{REQUEST_URI} !^/index\.cfm
RewriteRule (.+) /index.cfm?event=baduri&uri=$1
看到这个问题: Rewriteengine in .htaccess to catch files not ending in html