Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

The website I work on had these two pages in the past:

http://www.africananimals.com/stripes/zebras

and

http://www.africananimals.com/news/zebras

(These are not actual domain names, just examples.)

The directory structure had been recently reorganized, and the URLs for the same pages changed to:

http://www.africananimals.com/zebras/stripes

and

http://www.africananimals.com/zebras/news

I want a mod_rewrite rule (or a less resource-consuming alternative method, such as Redirect command or something similar) to benefit those enthusiasts who had both pages bookmarked with old URLs. I need this to work for both http//www.africananimals.com and http//africananimals.com/ versions of the URLs.

My solution would be this:

Redirect /stripes/zebras http://www.africananimals.com/zebras/stripes
Redirect /news/zebras http://www.africananimals.com/zebras/news

– but I'm not sure if I'm correct. Being awful at regex, and having only superficial understanding of .htaccess, I'd sure be grateful for some guidance.

share|improve this question
1  
What's wrong with it? –  Michael Hampton Feb 10 '13 at 19:39
    
I'm simply looking for the fastest and least resource-consuming solution. Do you think this one would be better than mod_rewrite? –  Dimitri Vorontzov Feb 10 '13 at 19:41
1  
Did you test it? Does it work? If so don't worry too much about resource consumption. This will be nothing compared to the load placed by normal requests. –  dunxd Feb 11 '13 at 10:25
add comment

closed as not constructive by Michael Hampton, freiheit, mdpc, Khaled, MDMarra Feb 11 '13 at 14:20

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

up vote 1 down vote accepted

You'd probably gain more in terms of flexibility by using mod_rewrite.

The other alternative is a "redirection app". This one was the product of a fairly large-scale redesign of UK web-facing government services, and apparently Rewrite rules would've gotten too unwieldy.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.