Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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:
Yes I have done that however i was looking for if someone goes to example.co it will forward to example.com instead.
Do you want to change the hostname in the URL, so it becomes example.com?
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
RewriteCond %{HTTP_HOST} !^example.com [NC]
RewriteRule ^/(.*) http://example.com/$1 [R=301]
Do you want to change the hostname in the URL, so it becomes example.com?
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
RewriteCond %{HTTP_HOST} !^example.com [NC]
RewriteRule ^/(.*) http://example.com/$1 [R=301]
I tried that but it didn't work what might i be doing wrong here
Code:
LoadModule rewrite_module modules/mod_rewrite.so
Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^example.com [NC]
RewriteRule ^/(.*) http://example.com/$1 [R=301]
When i go to example.info it still doesn't redirect to example.com , so basically to clear up some things I only have some cookie sessions that run off the .com address however instead of rewriting a bunch of new cookie sessions I'd rather just redirect all traffic over the .info .co .net and .org to go to the .com address.
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.
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.
You can also add a logfile directive if you want to find out which of your domains or variations is being used.
Thank kind of works, but i get looping errors
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.
Having them all in the one vhost container means every request is being re-written, INCLUDING the ones to www.example.com, that's causing your looping.
You could also take ServerAlias example.com out and put it in the redirect container too.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.