I have an application that I have rewritten with rails. Old application is in php.
I need to redirect all php requests to a subdomain old.example.com (I have put my old application to run there) so that the old links would still work. I believe all of the links have a “.php” in them and none of my new urls have that. So it could be used as a condition for redirecting.
I have planned to use apache RedirectMatch. So something like:
RedirectMatch \.php http://old.example.com
should be close. I believe. I just don’t know how to pass the request path to the redirect rule.
Or if someone has a better idea how to do this?
Using Apache mod rewrite, you would use the following:
If you want to actually insert the page they were trying to reach in the redirect URL:
$1will insert anything that matches the regular expression in the parentheses.For GET parameters: