Setting a preferred domain for your blog
The preferred domain means the address you want your visitors to see when they come to your site. That is http://exnol.com or http://www.exnol.com in my case. you can do this easily if you are on Apache. edit the .htaccess file as follows :
RewriteEngine On
RewriteCond %{HTTP_HOST} ^YOURDOMAIN.com$ [NC]
RewriteRule ^(.*)$ http://www.YOURDOMAIN.com/$1 [R=301,L]
If an htaccess file doesn’t exist, add the above code to a text file, name it .htaccess and save it at your root directory.If “ReWriteEngine On“ is already in your htaccess file the ignore the first line. Replace YOURDOMAIN with your sites domain name. There can be problems if you use this along with
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
If you use them together some problems may occur during file access.
RewriteEngine on
This line starts the mod_rewrite module
RewriteCond %{REQUEST_FILENAME} !-d
If the request is for a real directory (one that exists on the server), index.php isn’t served.
RewriteCond %{REQUEST_FILENAME} !-f
If the request is for a file that exists already on the server, index.php isn’t served.
RewriteRule ^(.*)$ /index.php
So there can be errors. I faced them while rewriting my .htaccess file but doesn’t remember the error correctly.
Related posts : (sorted by relevence)
- Setting a FAVorite ICON for your site
- Free service that lets you find out everything about a domain name
- Google has removed the warning for results from this blog
- Wordpress blog painfully slow except for front page
- How to get your new blog post indexed instantly by Google
- Setting the correct aspect ratio for a video
If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments
No comments yet.
Leave a comment