如何使用 modrewrite 进行重定向
我在使用 mod 重写时遇到问题。 虽然我对它的使用知之甚少。 这是我的问题 我设置了当前的重定向规则
RewriteRule !(\.gif|\.png|\.jpe?g|\.css|\.js|\.php|^mr/.*)$ index.php [nocase,last]
,但它的作用是保留在index.php中,而网址中有一个/ 例如 mysite.com/about/
...它将重定向到我的 php 代码中的 about.php
... 但我想要的是,如果文件夹存在,它应该转到该文件夹 如果该文件夹不存在,则应使用重写
i am having an issue working with mod rewrite.
although i have a very vague knowledge using it.
This is my issue
i have this current redirect rule set up
RewriteRule !(\.gif|\.png|\.jpe?g|\.css|\.js|\.php|^mr/.*)$ index.php [nocase,last]
but what this does is stay in the index.php while there is a / in the url
for example mysite.com/about/
...which will redirect to about.php
in my php code...
but what i want is if a folder exists it should go to the folder
if the folder doesn't exists it should then use the rewrite
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
把这个放在你的规则之上
RewriteCond %{REQUEST_FILENAME} !-d
Put this above your rule
RewriteCond %{REQUEST_FILENAME} !-d