【发布时间】:2010-10-06 11:47:53
【问题描述】:
我刚刚将我的网站上传到 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中加了斜线,等了两个小时,还是一样。
有什么想法吗?
【问题讨论】:
标签: php url .htaccess mod-rewrite