I am trying to achieve something like, that is on the below link.
This website is at the above URL. But even if you type .co.uk or .net or .org Like this any Extension. The URL will be automatically redirected to http://www.laterooms.com/
I am trying to achieve something like, that is on the below link.
This website is at the above URL. But even if you type .co.uk or .net or .org Like this any Extension. The URL will be automatically redirected to http://www.laterooms.com/
Assuming you own all the domains, and they all point to the same webserver, then this code should do it;
Basically -- have javascript test what domain you currently are on, and if not on the .com then update the URL and store it back into the location.href for the page which will automatically trigger a page-reload with the new URL.
The above code preserve the URL path within the domain, so if somebody types in
will redirect to
If you don't want to preserve the path
/mypath/here
then the code will be sligthly simpler as you can just hardcode the destination path rather than using thejoin
If you own/have possession of those other domains..
You could set forwarding (dns settings) for each of the domains you wish to redirect to the primary domain.
That would get you away from having to code a page for each one of those domains.
Much cleaner, and easier.
You can either use different techniques on server side to force a redirect, or you can send a page containing a redirect
Refresh: 0; url=http://www.example.com/
Wikipedia has a good overview on this.
First of all, you should be in possession of the other domains (with the extensions you want). Then you can either use javascript to set
top.location.href='http://your.address.com/'
or use other means, like setting up your web server to redirect the requests, or your domain name registrar.