Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

redirect http://*.olddomain.com to https://*.old-domain.com

Status
Not open for further replies.

csgonan

MIS
May 2, 2007
118
US
I need to redirect all references to *.olddomain.com to (with a dash). The site is a wildcard and they can enter anything for * so they have to not lose the vaue of * when redirecting.

I also need to redirect all references of to Again I do not want to lose the value of * that they typed in.

I can do this with redirect or rewrite, whichever is easier please.

Thank you
 
It looks to me like you have already answered your own question: use redirect or rewrite rule, which ever is easier.

Off hand, I don't recall if redirect accepts wild cards, but of the two rules it is (IMHO) easier to use.

If redirect doesn't accomplish what you are after, rewrite most certainly would. I would suggest using a regex to pattern match the string. I am not an expert in regex but I think you would want to use something like .*/.old-domain/.com to match zero or more of any character followed by old-domain.com. If that is too generic, or your regex pattern matcher is greedy (i.e. .* matches too much) then try a more refined search like [^/t .]* (not white space and not a .).

You won't loose the value of what matched to *, rather it will be available as a variable, such as $1. You will need to read the documentation.

If you are looking for info on the regular expressions, the book Mastering Regular Expressions by Jeff Friedl(? - I think) is pretty good.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top