htaccess重写

发布于 2024-09-28 20:59:37 字数 641 浏览 0 评论 0原文

我现在使用:

RewriteEngine on 
RewriteRule !^index.html http://samedomain.com [L,R=301]

以便所有查询都进入 http://samedomain.com ...(通常它会加载索引.html) index.html 被排除,因此它不会出现无限循环。

我可以打开 http://samedomain.com/index.html 很好..它不会重定向。 对子页面的其他请求会重定向到 http://samedomain.com 但它不会打开页面。

如果您能告诉我如何将所有请求重定向到,那就太好了 http://samedomain.com 以及如何排除 2 个文件(index.html 和 image.jpg) 排除在该重新路由之外。

谢谢 克里斯

I use right now:

RewriteEngine on 
RewriteRule !^index.html http://samedomain.com [L,R=301]

so that all inquires go the http://samedomain.com ...(usualy it would load index.html)
the index.html is excluded so it does not come a endless loop.

i can open http://samedomain.com/index.html FINE.. it does not come redirected.
And other requests to subpages come redirected to http://samedomain.com
BUT it does not open the page.

Would be great you can tell me how to redirect all requests to
http://samedomain.com AND how to exclude 2 Files (the index.html and an image.jpg)
excluded from that rerouting.

thx
chris

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

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

发布评论

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

评论(1

娇俏 2024-10-05 20:59:37
RewriteCond %{REQUEST_URI} !^/?index\.html$
RewriteCond %{REQUEST_URI} !^/?image\.jpg$
RewriteRule /?(.*) http://samedomain.com/$1 [L]
RewriteCond %{REQUEST_URI} !^/?index\.html$
RewriteCond %{REQUEST_URI} !^/?image\.jpg$
RewriteRule /?(.*) http://samedomain.com/$1 [L]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文