Redirecting all URLs to .com rather than .biz,, .info

I was having this problem with my current site. I have several domains like

Even the problem was Google was indexing all these pages separately and which is not good from the SEO perspective. Therefore, we

This thing is also called as CANONICAL DOMAIN

I used the following code to force all URLs to go to

RewriteBase /
RewriteCond %{HTTP_HOST} !^(www\.)?ukwhitegoods\.co\.uk$ [NC] ////This means was anything other than this pattern is fired, follow the rule

///NC means case sensitive URL
RewriteRule ^(.*)$$1 [R=301,L] ////Its a permanent redirect and LAST RULE

So now all my landing pages goes to

.htacess redirect and rewrites

I am writing this blog for a very simple usage of htaccess for redirects and rewriting the url

The first things that needs to be understand for the htaccess REWRITE and REDIRECT modules are the synstax


marks the start of line. It means anything that starts with

$ marks the end of line.

(.*) means any character within the url. This gets replaced by $1 at first occurence and $2 as second occurence

L means last code and do not execute anything after this.

R means redirect the page, so the url will be changed. However if you do not add that, it will be same.



Now here are some sample code


RewriteRule ^styles/ - [L,NC]

Now the above code means that if any url starts with style, just let it go through it. for example


RewriteRule ^resources/image/thumb/(.*)/?$ /download/file.php?id=$1&t=1 [NC,L] # Handle product requests

If any url starts with resources/image/thumb/(.*){THIS COULD BE ANY STRING}/

Go to looking for$1&t=1

Here $1 is (.*){THIS COULD BE ANY STRING}/



RewriteRule ^resources/image/(.*)/rokbox.jpg?$ /download/file.php?id=$1&mode=view/rokbox.jpg [NC,L] # Handle product requests

RewriteRule ^(.*)/$ $1.html [R,NC,L] # Permanent Move
RewriteRule ^(.*)/(.*)$ $2 [R,NC,L] # Permanent Move



To exclude a file from htaccess rule: follow this

RewriteCond %{REQUEST_URI} !^/google89b2a81fd1609a6e\.html$