Web Hosting Talk







View Full Version : How do i redirect /~user


-Edward-
06-10-2001, 05:15 PM
How can i redirect it so that /~username goes to the main domain. I dont want todo it for all my accounts just some. Since some are just plainly used for email and others are used for webspace.

jtan15
06-10-2001, 06:05 PM
In your httpd.conf file, put this line for each user:

Redirect /~username http://www.theirdomain.com

Reboot Apache, and voila. Hope this helps. :)

(SH)Saeed
06-10-2001, 06:31 PM
Another way would be to simply create a file named "index.php" and inside it type <?php header("Location: /"); ?>. Then simply copy this file to any sub directory under a domain and it will automaticly redirect the users to the main site.

Enjoy.

-Edward-
06-10-2001, 06:38 PM
I used Vincents way and it does exactly what i need thanks :)

(SH)Saeed
06-10-2001, 06:40 PM
That's great, just keep in mind that the problem with Vincent's way is that every single time you want to add a user to this you will have to edit httpd.conf and then restart apache.

-Edward-
06-10-2001, 06:55 PM
Didnt think of that .... just to add to that ill use your way too :)

kentaurus
06-10-2001, 11:52 PM
I don't know if it is because of the new patches, but recently when I update a virtual site or add a new one via the cobalt control panel my custom changes at httpd.conf aren't modified. Then you could easily add that line and as long as you don't update the specific virtualsite that contains the redirect you should be safe.

c0bra
06-11-2001, 03:53 AM
Another way would be to create a static link from the users web directory to your main directory.

ln -s /home/sites/whatever/web /home/sites/whatever/users/web/

Chicken
06-11-2001, 08:57 AM
..or a redirect via .htaccess