htaccess 也重定向子文件夹
我是 htaccess 规则的新手。我试图搜索我的问题但无法得到答案,所以我在这里写下这个问题。
我的 php 应用程序的根文件夹中有以下 htaccess 文件
RewriteCond %{HTTP_HOST} www.mydomain.com
RewriteRule (.*) http://www.mydomain.com/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php
现在,如果我添加任何子文件夹 images/ 我会收到错误消息“找不到 URL”。我怀疑某些 htaccess 规则导致了这种情况。
如果有人能向我解释原因,我将非常感激。
谢谢你,
I am new to htaccess rules. I have tried to search about my questionm but couldn't get the answer, so I am writing the question here.
I have the following htaccess file in my root folder of my php application
RewriteCond %{HTTP_HOST} www.mydomain.com
RewriteRule (.*) http://www.mydomain.com/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php
Now if I add any sub-folder images/ I get the error stating "URL not found". I suspect some of the htaccess rules is causing this.
I would really appreciate if someone could explain me the cause.
Thank you,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的重写条件是将每个网址应用到您的域。您可以执行的操作从中排除图像文件。我认为使用这个会有帮助
Your rewrite condition is applying every url to your domain. What you can do exclude image files from this. I think using this will help