Web Hosting Talk







View Full Version : Help with redirecting please?


venomx
04-13-2006, 01:04 AM
I have a few dozen domains I wish to now point to one site.
I have given up on all but one or two of my sites now since I have way less time to come online.

In my .htaccess I have

Options +FollowSymLinks
RewriteEngine on
Redirect 301 / http://www.mymaindomain.net/

which works. But /whatever or /whatever.html(.php etc) still looks for a 404 error. Is there a way to redirect Everything to http://www.mymaindomain.net/?

Like http://www.olddomain.com or http://www.olddomain.com/whatever.php to just http://www.mymaindomain.net/?

I want to set up one account on my VPS for olddomain.com and park all my old domaisn on top of it and they all use the same .htaccess and redirect to http://www.mymaindomain.net/

CreativeLogic
04-13-2006, 08:41 AM
Try this code:
RedirectMatch 301 ^/(.*) http://www.example.com/$1

This will redirect all files to the appropriate files on the other domain.

venomx
04-13-2006, 09:59 AM
Well I dont want it to send them to the matching files on the other domain since they will be 404.... Would really like to just send them to the index.php

stdunbar
04-13-2006, 01:54 PM
Do you have permission to modify the Apache config file? I had the same thing and I did:


<VirtualHost *>
ServerName www.oldhostname.tld
Redirect permanent / http://www.newhostname.tld/
</VirtualHost>


Edit - no, this has the same problem you described - anything to the right 404's

FileGig
04-14-2006, 08:59 PM
Could you set a custom 404 error page to be a simple PHP redirect script for every domain?

Neoboffin
04-15-2006, 05:12 AM
Just rewrite CreativeLogic's code given.

RedirectMatch 301 ^/(.*) http://www.example.com/