在这里我错了,在这个htaccess的,因为/资产/文件夹不排除重写规则。 当我访问: https://p.xsw88.cn/allimgs/daicuo/20230902/182.pngs 不返回404如我所料。
where I'm wrong in this htaccess, because /assets/ folder isn't excluded from rewrite rule. When I access: https://p.xsw88.cn/allimgs/daicuo/20230902/183.pngs isn't return 404 as I expected.
Options -Indexes
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/?(assets|css)/
RewriteRule . index.php
感谢
推荐答案
您的规则说:
改写一切的index.php时:
rewrite everything to index.php when :
该URL不是一个文件,而不是一个目录,而不是在 /资产/
或 / CSS /
。
The URL is not a file and is not a directory and is not in /assets/
or /css/
.
你问的文件不是一个文件,而不是一个目录,并在资产/
:
The file you're asking is not a file, not a directory and is in assets/
:
这样就OK了规则,但是!您的日志显示,那么你所要求的 /home/valentin/public_html/404.shtml
(自动重定向不明物体!)
So ok for the rule, BUT! your log show you are then asking for /home/valentin/public_html/404.shtml
(automatic redirection for the unknown object!)
和这个请求通过的规则了!
And this request goes through the rules again!
这是不是一个文件(!-f匹配),而不是一个目录(!-d匹配),它是不是在资产/
也不在 CSS /
然后它被改写到的index.php
It is not a file (!-f matched), not a directory (!-d matched) and it is not in assets/
nor in css/
then it gets rewritten to index.php
Q.E.D。
您可以通过将404.shtml在的public_html /
文件夹中解决这个问题,还是Apache的配置更改为一个真正的文件。
You can correct this by putting the 404.shtml in your public_html/
folder, or change this in apache configuration to a real file.
相关推荐
最新文章