【问题标题】:Homepage issue/ modrewrite主页问题/ modrewrite
【发布时间】:2011-07-26 16:17:35
【问题描述】:

对 Web 开发/托管/脚本非常陌生。

使用 PHP 在 Apache 上运行通过网络解决方案托管的电子商务购物车。

我的第一个问题是我指定的购物车模板一直恢复为默认值。 第二个问题:访问我的网站(jewelrydesignstudio.net)时,页面 404s 并没有重定向到index.php/home

我联系了购物车客户支持,以尝试在纠正问题方面获得一些帮助,这就是回应。

感谢您联系技术支持。看起来像你的服务器 没有启用 mod_rewrite。启用它应该可以解决它。

我有很少的网络开发经验,上次我搞砸任何编码或脚本是在几年前,但据我所知,mod_rewrite 是通过 FTP 上的 htaccess 文件启用的。

这是我的 htaccess:

Options +FollowSymLinks

RewriteEngine on
RewriteCond %{HTTP_HOST} ^jewelrydesignstudio.net
RewriteRule (.*) http://www.jewelrydesignstudio.net/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
RewriteRule ^index\.html$ http://www.jewelrydesignstudio.net [R=301,L]

好像模板问题已经解决了,但是访问时仍然没有指向我的主页(jewelrydesignstudio.net)。

是的,我很新,这很可悲:P 谢谢你的帮助!

【问题讨论】:

    标签: php apache .htaccess mod-rewrite rewrite


    【解决方案1】:

    嗯...很难说到底出了什么问题——我对你的网站一点也不熟悉。

    这里有一些建议(我已将我的规则与您的 htaccess 结合起来):

    Options +FollowSymLinks
    
    RewriteEngine on
    RewriteBase /
    
    RewriteCond %{HTTP_HOST} ^jewelrydesignstudio.net
    RewriteRule (.*) http://www.jewelrydesignstudio.net/$1 [R=301,L]
    
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
    RewriteRule ^index\.html$ http://www.jewelrydesignstudio.net [R=301,L]
    
    # do not do anything for already existing files
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule .+ - [L]
    
    # home page
    RewriteRule ^$ /index.php?p=home [QSA,L]
    

    如果我请求/index.php?p=home,它会显示主页。上面的最后一条规则应该可以完成这项工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-11-26
      • 1970-01-01
      • 1970-01-01
      • 2011-05-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多