We have developed a wordpress site recently, if i just type http://example.com in browser i will get the site, but if i type www.example.com it is not displaying anything, what happened to it, is there any problem to my htaccess? My site url and homeurl is http://example.com, i have tried with different options in my htaccess badluck, i just want to redirect the www.example.com to http://example.com.
-
You can do that in your web hosting control panel– Brad DaltonCommented Jan 9, 2014 at 8:28
-
that i have did but it is not redirecting, is there any thing i can so in .htaccess file.– NaveenCommented Jan 9, 2014 at 8:38
-
Can you please paste the content of your htaccess file in the question ?– SubharanjanCommented Jan 9, 2014 at 10:34
-
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /example.com/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /example.com/index.php [L] </IfModule> # END WordPress– NaveenCommented Jan 9, 2014 at 12:27
Add a comment
|
2 Answers
Try this into htaccess
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
Can you check which IP address it points to when www version of your url is accessed ? Is it the same as your non-www version one ? If YES, then paste the below code on top of the htaccess file. Search and replace all the www versioned urls from DB to non-www versioned( if any ).
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^example\.com
RewriteRule (.*) http://example.com/$1 [R=301,L]
To check if both urls are pointing to same host, you can use Flagfox addon