在godaddy托管上重写URL

时间:2010-10-06 11:47:53

标签: php url .htaccess mod-rewrite

我刚刚将我的网站上传到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添加斜线并等了两个小时,但它仍然是相同的。

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

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