Ask HN: Help with this 301 redirect?
stackoverflow.com
stackoverflow.com
Simply move your data and set up mod_rewrite to allow access to the data in its old location.
You can 301 it but there are all sorts of pitfalls to avoid there. (not sure how much traffic you get from search engines but they tend to react badly to redirects if not done very carefully)
I've got a drupal site configured so the groups have URLs like groupname.domain.com/
I'm using the subdomain module (http://drupal.org/project/subdomain) to create these "fake" subdomains.
For a few reasons, I want to move to a structure like this:
domain.com/groups/groupname
I can switch off the subdomain module and change the paths to my existing groups to take the desired format. But I need to redirect all traffic going to the old URLs to the new ones.
You're saying adding a Redirect to my htaccess isn't the best way to go? The guy over on stack overflow suggested a rule but it creates an infinite redirect loop.
Probably you are matching too much.
with the information you gave above I see a much simpler way to solve this:
Set up your webserver (I'm assuming apache) to map www.yourdomain.com and yourdomain.com to one virtual host and .yourdomain.com to another.
Then do the .htaccess in the root of the virtualhost associated with .yourdomain.com
That way you can not make any infinite loops.
good luck!
Don't sweat it, everybody goes through this phase when they start with mod_rewrite, then after a while it gets easier.