Reputation: 212
I have created one wordpress site. As I write domain name without www then it opens correctaly but as I write www. in url it's not showing the site.
Please help me.. Thank you in advance.
I have edited my question and added the following part :
Following is my file : Where I have to put code provided by you ? I tried it before the "Begin Wordpress" line but still not working.
.htaccess
"# -FrontPage-"
IndexIgnore .htaccess /.?? *~ *# /HEADER */README* */_vti*
order deny,allow
deny from all
allow from all
order deny,allow
deny from all
AuthName example.com
AuthUserFile /home/example/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/example/public_html/_vti_pvt/service.grp
"# BEGIN WordPress"
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
"# END WordPress "
Upvotes: 1
Views: 576
Reputation: 21681
Try to follow below steps:
1) Add CNAME record for www and set value/points to as @. OR you can do vice-versa
2) Under Wordpress, Set your domain with www under Home and Site URL. e.g. www.example.com
3) Add redirect code in .htaccess
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
In Wordpress, #3 is optional. Wordpress will manage automatically to open site with www if you set as per #2.
Upvotes: 0
Reputation: 3207
Write below code in your .htaccess file
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
Upvotes: 1
Reputation: 464
Write this in your .htaccess file:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
Upvotes: -1
Reputation: 4094
This happens when your DNS has insufficient configuration. Your site already has an A record ("example.com" that points at some IP).
But you also need to make the www-part work by adding a CNAME record. CNAME can be configured in two basic ways:
So you have:
A Record
Host: example.com
IP: 5.5.5.5
CNAME
Host: *.example.com (or www.example.com)
Remember also to add a MX record if you want to configure the mail domain.
Upvotes: 1