dongraobei6719 2016-12-28 12:25
浏览 10

.htaccess重定向不工作非www url到www url

I have tried below code to redirect non www to www url in wordpresss but its not working .

Please check below code is right one?

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.ie[nc]
RewriteRule ^(.*)$ http://www.domain.ie/$1 [r=301,nc]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

</IfModule>
  • 写回答

2条回答 默认 最新

  • doufei5537 2016-12-28 12:43
    关注

    According to the manual at https://www.ostraining.com/blog/wordpress/non-www/

    The correct code is

    RewriteCond %{HTTP_HOST} ^yourdomain.com [NC] RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]

    Otherwise there may be a other problem that you can reprocedure from the error logs

    评论

报告相同问题?