godaddy 托管上的 URL 重写

发布于 2024-09-26 11:33:11 字数 987 浏览 1 评论 0原文

我刚刚将我的网站上传到 GoDaddy 托管,但遇到了一些 URL 重写问题。谷歌充满了类似的抱怨,但没有一个修复可以帮助其他人为我解决问题。

我的 .htaccess 文件如下所示:

DirectoryIndex index.php
AddDefaultCharset utf-8

RewriteEngine on
Options +FollowSymlinks -MultiViews -Indexes   
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?path=$1 [L,QSA]

我按预期将处理重定向到 index.php,但对于 http://example.com/ products 我的 $_GET 数组看起来像这样:

array(
    [404;http://example_com:80/products] => ''
)

但应该看起来像这样:

array(
    [path] => '/products'
)

我无法理解这意味着什么。

以下是在 google 中找到的人们问题的常见解决方案:

  • 添加 Options +FollowSymlinks -MultiViews

  • 添加 RewriteBase /

  • 在重写规则中向index.php 添加悬挂斜杠

。 htaccess本来就有前两个,我在index.php里加了斜杠,等了两个小时,还是一样。

有什么想法吗?

I've just uploaded my site to GoDaddy hosting and experiencing some problems with URL rewriting. Google is full of similar complains but non of the fixes that help the others did the trick for me.

My .htaccess file looks like this:

DirectoryIndex index.php
AddDefaultCharset utf-8

RewriteEngine on
Options +FollowSymlinks -MultiViews -Indexes   
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?path=$1 [L,QSA]

I get processing redirected to index.php as expected, but for http://example.com/products my $_GET array looks like this:

array(
    [404;http://example_com:80/products] => ''
)

but should look like this:

array(
    [path] => '/products'
)

I can't understand what this means.

Here are common solutions of peoples problems found in google:

  • Add Options +FollowSymlinks -MultiViews

  • Add RewriteBase /

  • Add perpending slash to index.php in rewrite rule

My .htaccess had first two originally, and I added slash to index.php and waited two hours, but it's still the same.

Any ideas?

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

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

发布评论

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

评论(1

旧伤还要旧人安 2024-10-03 11:33:11

无法找到解决此问题的方法。需要编写解决方法......

Could't find a way to fix this problem. Needed to code a workaround...

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