重写规则给出 500 错误

发布于 2025-01-06 03:28:21 字数 310 浏览 2 评论 0原文

Options +FollowSymLinks
RewriteEngine On

RewriteRule ^files/(.*) files/index.php

RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]

我试图将文件目录中的所有内容重写为 index.php ,它也在文件目录中。页面显示但总是给出500错误,有人可以帮助我吗?

Options +FollowSymLinks
RewriteEngine On

RewriteRule ^files/(.*) files/index.php

RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]

I am trying to rewrite everything in the files directory to index.php which is also in the files directory. The page displays but always gives a 500 error , can anyone help me please ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

念﹏祤嫣 2025-01-13 03:28:21

以相同的顺序执行此操作:

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule ^ - [L]

RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]

RewriteCond %{REQUEST_URI} ^/files [NC]
RewriteRule ^(files)/.* $1/index.php [L]

Do this in the same order:

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule ^ - [L]

RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]

RewriteCond %{REQUEST_URI} ^/files [NC]
RewriteRule ^(files)/.* $1/index.php [L]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文