错误的301 htaccess重定向

时间:2012-10-05 14:00:00

标签: .htaccess http-redirect

我的网站上有此代码,我需要将http://softsolutions.fr重定向到http://www.softsolutions.fr,但不会重定向:

<IfModule mod_rewrite.c>    
  Options +FollowSymlinks
  Options +Indexes
  RewriteEngine On

    RewriteCond %{HTTP_HOST} ^softsolutions\.fr
    RewriteRule ^(.*)$ http://www.softsolutions.fr/index.html [R=301,L]     

  RewriteRule    ^$    /index.html    [L]

    # Rewrites "sub.domain.foo/anything" to "sub.domain.foo/anything.php"
    RewriteCond %{REQUEST_FILENAME} !^(.+).php$
    RewriteCond %{REQUEST_FILENAME} !^(.+).pdf$
    RewriteCond %{REQUEST_FILENAME} !^(.+).(html|htm)$
    RewriteRule    ^([a-zA-Z0-9\-\_/]*)$    /$1.php    [L]  

</IfModule>

1 个答案:

答案 0 :(得分:0)

替换这些行:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^softsolutions\.fr
RewriteRule ^(.*)$ http://www.softsolutions.fr/index.html [R=301,L] 

使用:

RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^softsolutions\.fr [NC]
RewriteRule (.*) http://www.%{HTTP_HOST}%{REQUEST_URI}