godaddy 托管上的 URL 重写
我刚刚将我的网站上传到 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
无法找到解决此问题的方法。需要编写解决方法......
Could't find a way to fix this problem. Needed to code a workaround...