【问题标题】:index.php 301 Redirect not working for Joomla siteindex.php 301 重定向不适用于 Joomla 网站
【发布时间】:2012-04-12 15:25:33
【问题描述】:

我在我的 Joomla 网站上尝试了 .htaccess 中的以下代码,但它根本不起作用:

Redirect 301 /index.php /

我也试过了:

Redirect 301 www.domain.com/index.php www.domain.com/

基本上我不想有重复的页面,目前我可以查看带有 index.php 和不带的主页。

我不知道为什么 Joomla 会这样做,但它根本不起作用。我也在 Artio SEO 组件下做了 301 重定向,但它也不起作用。

【问题讨论】:

    标签: php .htaccess mod-rewrite joomla


    【解决方案1】:

    试试这个:

    <IfModule mod_rewrite.c>
      RewriteEngine on
    
      RewriteCond %{THE_REQUEST} ^.*/index.php
      RewriteRule ^(.*)index.php$ "http\:\/\/www\.yourdomain\.com\/$1" [R=301,L]
    </IfModule>
    

    【讨论】:

    • 太棒了。它正在工作,谢谢。我们知道为什么上面的 Redirect 301 不起作用吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-10-10
    • 1970-01-01
    • 2017-08-28
    • 2013-11-01
    • 2017-03-18
    • 1970-01-01
    • 2013-10-31
    相关资源
    最近更新 更多