Question

Facing Post Redirection Issue

Posted December 17, 2016 1.3k views
WordPress

Hi,

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]

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
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.

Submit an Answer