0

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.

4
  • You can do that in your web hosting control panel 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.
    – Naveen
    Jan 9, 2014 at 8:38
  • Can you please paste the content of your htaccess file in the question ? 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
    – Naveen
    Jan 9, 2014 at 12:27

2 Answers 2

0

Try this into htaccess

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
0

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

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.