RewriteRule是重定向而不是重写

发布于 2024-09-27 15:52:40 字数 476 浏览 1 评论 0原文

我有一个如下所示的重写规则:

RewriteEngine On
RewriteRule ^$ store [L]

这是 .htaccess 文件中唯一的内容。

它应该允许某人访问 http://www.site.com/ 并根据服务器,他们正在访问 http://www.site.com/store

但它正在重定向用户。换句话说,您会在 URL 中看到“/store”。我该如何避免这种情况?

顺便说一句,/store/index.php(store 目录中的索引脚本)中没有进行重定向。我知道这一点是因为我在那里放置了一个 die 语句,并且当脚本执行时,“/store”位于 URL 中死在那个剧本上。

I have a rewrite rule that looks like this:

RewriteEngine On
RewriteRule ^$ store [L]

That's the only thing in the .htaccess file.

It's supposed to allow someone to go to http://www.site.com/ and according to the server, they're accessing http://www.site.com/store .

But it's redirecting the user. In other words, you see "/store" in the URL. How do I avoid this?

By the way, there's not a redirect going on within /store/index.php (the index script in the store directory. I know this because I put a die statement in there and the "/store" is in the URL when the script dies on that script.

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

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

发布评论

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

评论(1

久光 2024-10-04 15:52:40

由于某种原因,我将其更改为

RewriteRule ^$ store [L]

RewriteRule ^$ /store/ [L]

开始工作

For some reason, I changed it from

RewriteRule ^$ store [L]

to

RewriteRule ^$ /store/ [L]

and it started working

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