不要重写代表文件的 URL

发布于 2025-01-07 07:25:57 字数 277 浏览 2 评论 0原文

# These settings routes all traffic, except concrete files, to the dispatcher

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.*)$ index.php [NC,L]

问题是它确实将具体文件路由到调度程序:(

我怎样才能使像 http://site.com/style.css 这样的 URL 被忽略?

# These settings routes all traffic, except concrete files, to the dispatcher

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.*)$ index.php [NC,L]

The problem is that it does route concrete files to the dispatcher :(

How can I make it so URLs like http://site.com/style.css are ignored?

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

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

发布评论

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

评论(1

兰花执着 2025-01-14 07:25:57

尝试这个并让我知道:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.php [NC,L]

您正在将所有内容重写到index.php,这将检查文件/文件夹/符号链接是否存在,然后加载文件(如果存在)。

Try this and let me know:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.php [NC,L]

You were rewriting everything to the index.php, this will check if the file/folder/symlink exists and then load the file if it does.

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