.htaccess 排除目录

发布于 2024-12-27 00:02:19 字数 300 浏览 1 评论 0原文

我在从重写规则中排除一些目录时遇到了一些麻烦。

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(cultivsearchenginesitemap|RSS)($|/) - [L]
RewriteRule ^(.*)$ http://www.niklashjelm.se/$1/ [L,R=301]

我想排除第三行上的目录,但它们不断收到尾部斜杠,并尝试将其放置在最后一行之前和之后。有什么想法吗?

I'm having some trouble excluding a few of my directories from a rewrite rule.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(cultivsearchenginesitemap|RSS)($|/) - [L]
RewriteRule ^(.*)$ http://www.niklashjelm.se/$1/ [L,R=301]

I want to exclude the directories on the third line but they keep getting the trailing slash, have tried placing it before and after the last line. Any ideas?

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

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

发布评论

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

评论(1

铁轨上的流浪者 2025-01-03 00:02:19

如果您说您不希望这两个目录发生重定向到 www.niklashjelm.se 的情况,那么第 3 行应该是条件(或对此进行一些调整):

RewriteCond $1 !^(cultivsearchenginesitemap|RSS)/?

If you are saying that you don't want the redirect to www.niklashjelm.se to occur for these two directories then line 3 should be the cond (or some tweak to this):

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