Forwarding mutlitable domains
I have a bunch of domains .com .co .info, etc. I want them all to point forward to .com when you go to any of them I know this is possible through the .htaccess file but I am having trouble finding documentation on this. Can anyone help me with this is driving me mad lol
thanks |
Hi,
You didn't mention your webserver, but you said about .htaccess I guess it's apache. In this case, assuming that you have the correct dns entries, so each .com, .co, .info resolve to the IP of your apache, all you have to do is to use: Code:
ServerName www.domain.com |
Yes I have done that however i was looking for if someone goes to example.co it will forward to example.com instead.
|
Quote:
In this case in addition to the above, you should use mod_rewrite either in .htaccess or in the apache config file: Code:
RewriteEngine on |
Quote:
Code:
LoadModule rewrite_module modules/mod_rewrite.so Code:
RewriteEngine on |
Quote:
Code:
RewriteRule (.*) http://example.com/$1 [R=301] |
You can also achieve this by creating a VirtualHost and doing the redirect directly in apache, this would be "lighter" as because there is no DocumentRoot apache doesn't have to read any files or traverse a path to find .htaccess files.
Example: Code:
<VirtualHost 188.138.103.171:80> |
Quote:
This webpage has a redirect loop The webpage at http://example.com/ has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer. Here are some suggestions: Reload this webpage later. Learn more about this problem. Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects. |
Check very carefully that you don't have www.yourdomain.com in the list of ServerAliases
The example I've given does work, I use it (with a lot more domain names) on my production server. |
Here is what i have
Code:
<VirtualHost *:80> |
Quote:
Code:
<VirtualHost *:80> You could also take ServerAlias example.com out and put it in the redirect container too. |
Perfection thank you for the help worked like a charm!
|
All times are GMT -5. The time now is 07:13 AM. |