.htaccess 如何对url为';s,其中包含的文件名不是在末尾,而是在斜杠之间
我想在htacess for Apache 2.4.29中对如下URL进行内部重定向:.htaccess 如何对url为';s,其中包含的文件名不是在末尾,而是在斜杠之间,.htaccess,url,redirect,mod-rewrite,.htaccess,Url,Redirect,Mod Rewrite,我想在htacess for Apache 2.4.29中对如下URL进行内部重定向: RewriteRule (?:^|/)[\w-]+(?:\.[\w-]+)+/ index.php?route=error/not_found [L,QSA] example.com/file.php/dir/dirnext example.com/dir/file.html/ example.com/dir/dirnext/file.jpg/onemoredir/ 等等 我的意思是,如果url中出现两
RewriteRule (?:^|/)[\w-]+(?:\.[\w-]+)+/ index.php?route=error/not_found [L,QSA]
- example.com/file.php/dir/dirnext
- example.com/dir/file.html/
- example.com/dir/dirnext/file.jpg/onemoredir/
- 等等
RewriteRule ^/(.*)/$ index.php?route=error/not_found [L]
您可以使用如下规则:
RewriteRule (?:^|/)[\w-]+(?:\.[\w-]+)+/ index.php?route=error/not_found [L,QSA]
nginx
实际上不支持mod_rewrite
或.htaccess
anubhava,对不起-我的错误。服务器是apache 2.4.29确定您是否希望对任何看起来像文件名的内容进行内部重写,例如example.com/foo/xyz.123/bar
,即使xyz.123
不作为文件存在。@anubhava,是的。