I have a non www setup for a domain X.com.bd . when typed www.X.com.bd it gives a net::ERR_NAME_NOT_RESOLVED error and brings cached copy suggestion page from google. I've written an .htaccess rule as
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
And here is my whole .htaccess snippet :
<IfModule mod_rewrite.c>
# Turn on URL rewriting
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
# Protect application and system files from being viewed when the index.php is missing
RewriteCond $1 ^(application|system|private|logs)
# Rewrite to index.php/access_denied/URL
RewriteRule ^(.*)$ index.php/access_denied/$1 [PT,L]
# Allow these directories and files to be displayed directly:
RewriteCond $1 ^(index\.php|robots\.txt|favicon\.ico|public|assets|resources|css|js|images|_assets|img)
# No rewriting
RewriteRule ^(.*)$ - [PT,L]
# Rewrite to index.php/URL
RewriteRule ^(.*)$ index.php/$1 [PT,L]
</IfModule>
Now all I need is to redirect www.X.com.bd to X.com.bd
Any help is appreciated and thanks in advance.