Facing Post Redirection Issue

December 17, 2016 1.1k views


I have one Wordpress website on Digital Ocean. I have installed Wordpress through Serverpilot. I have redirected xyz.com to www.xyz.com & Its Working Fine.

But a Post xyz.com/post-name.html is not redirecting to www.xyz.com/post-name.html
I have tried to do it by adding code in htaccess file, But Still I am facing Same Issue.

Code Added in Htaccess was -
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]

1 Answer

Hi, please make sure you’ve added these custom rewrite rules to the top of your .htaccess file. If you added them to the bottom of your .htaccess file, then the WordPress rules will take precedence and requests will never reach the custom rules you’ve added.

Have another answer? Share your knowledge.