这个 Mod 重写有什么作用?

发布于 2024-09-27 07:39:52 字数 665 浏览 0 评论 0原文

谁能告诉我这是做什么的?

RewriteRule .* .main.php [QSA,L]

据我了解,它会将任何内容重写到 main.php ,正确吗?但不太确定 QSA,L 是做什么的。

这是整个 .htaccess 文件,当我进入主目录时,我收到 400 Bad Request 错误。 编辑:当我在浏览器中添加结束斜杠到该脚本的根目录时,错误的请求消失了。

RewriteEngine On


# Transfering to the main tranfer file

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !\.css$
RewriteCond %{REQUEST_FILENAME} !\.js$

RewriteRule .* .main.php [QSA,L]

# nobody is allowed to access the access the  INI file

<FilesMatch "\.inc.php$">
    Order allow,deny
    Deny from all
</FilesMatch>

Can anybody tell me what this does?

RewriteRule .* .main.php [QSA,L]

From what I understand it will rewrite ANYTHING to main.php correct? But not so sure what the QSA,L does.

This is the whole .htaccess file, when I hit the main directory I get a 400 Bad Request error. Edit: Bad request went away when I added an ending slash in the browser to the root directory of this script.

RewriteEngine On


# Transfering to the main tranfer file

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !\.css$
RewriteCond %{REQUEST_FILENAME} !\.js$

RewriteRule .* .main.php [QSA,L]

# nobody is allowed to access the access the  INI file

<FilesMatch "\.inc.php$">
    Order allow,deny
    Deny from all
</FilesMatch>

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

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

发布评论

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

评论(1

跨年 2024-10-04 07:39:52

QSA = 查询字符串附加:将现有查询字符串附加到重写的规则中

L = 最后一条规则:集合的最后一条规则,不处理任何后续 RewriteRule

查看 文档 了解更多信息。

您是否有名为 .main.php 的文件?点前缀让我担心。您的规则显示,除非请求是存在的符号链接,或者具有 CSS 或 JS 扩展,否则它将转到 .main.php

QSA = Query String Append: append the existing query string to the re-written rule

L = Last Rule: last rule of the set, don't process any following RewriteRule

Check out the documentation for more.

Do you have a file that is named .main.php? The dot prefix worries me. Your rules read that unless the request is an exists, symbolic link, or it has a CSS or JS extension it goes to .main.php

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文