代码之家  ›  专栏  ›  技术社区  ›  Silver Light

godaddy主机上的URL重写

  •  2
  • Silver Light  · 技术社区  · 16 年前

    我刚刚把我的网站上传到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'
    )
    

    我不明白这是什么意思。

    以下是在谷歌中找到的解决人们问题的常用方法:

    • 添加 Options +FollowSymlinks -MultiViews

    • 添加 RewriteBase /

    • 将perpending斜杠添加到index.php索引重写规则中

    我的.htaccess最初有前两个,我在index.php索引等了两个小时,但还是一样。

    有什么想法吗?

    1 回复  |  直到 16 年前
        1
  •  0
  •   Silver Light    15 年前

    找不到解决此问题的方法。需要编码一个解决方案。。。

    推荐文章