我想把www.abc.com/index.php/ 301重定向至www.abc.com/
请问在.htaccess中如何写
查了半天,只把
www.abc.com/index.php改成www.abc.com了
而www.abc.com/index.php/改不了

解决方案 »

  1.   

    这是我的代码,请问如何实现 
    www.abc.com/index.php/ 301重定向至www.abc.com/上RewriteCond %{THE_REQUEST} ^.*/index.php
    RewriteRule ^(.*)index.php$ http://www.abc.com/$1 [R=301,L] RewriteCond %{http_host} ^abc.com [NC]
    RewriteRule ^(.*)$ http://www.abc.com/$1 [R=301,NC]
      

  2.   


    RewriteRule / index\.php [L]
      

  3.   

    试试这个?在我这里可以RewriteRule index\.php/? / [R=301]
      

  4.   

    完整的话这样应该可以了:RewriteCond %{HTTP_HOST} =www.abc.com [NC]
    RewriteRule index\.php/? / [R=301]
    不过不知道楼主这个匹配的目的是什么,index.php前面还有东西么?
    (.*)index.php
      

  5.   

    closure老大,不瞒您说,我是在网上找了一个抄的,不懂啥意思,惭愧惭愧!
    我现在要实现
    www.abc.com/index.php  301  www.abc.com/
    www.abc.com/index.php  301  www.abc.com/
    abc.com/index.php      301  www.abc.com/
    abc.com                301  www.abc.com/
    以及所有
    index.php/的都要定向到www.abc.com,
    不知道这个完整的该怎么写
    向您学习了
    谢了
      

  6.   

    修改一下
    index.php/的都要定向到www.abc.com/
      

  7.   


    RewriteCond %{HTTP_HOST} =www.abc.com [NC]
    RewriteRule index\.php/? / [L,R=301]RewriteCond %{HTTP_HOST} =abc.com [NC]
    RewriteRule .* http://www.abc.com/$0 [L,R=301]