I currently have a perm_redirects.conf file that gets included into my apache config stack where I have lines in the format
RedirectPermanent /old/url/path /new/url/path
It looks like I'm required to use an absolute URL for the new path, e.g.: http://example.com/new/url/path
. In the logs I'm getting "incomplete redirect target /new/url/path was corrected to http://example.com/new/url/path." (paraphrased).
In the 2.2 docs for RewriteRule
, at the bottom they show the following as being a valid redirect, with only the url-paths instead of an abs URL for the right hand side of the redirect:
RewriteRule ^/old/url/path(.*) /new/url/path$1 [R]
But I can't seem to get that format to work to replicate the functionality of the RedirectPermanent
version. Is this possible?
WFM:
Result:
Note (1) you probably want [R=permanent]. The default is a temp redirect. (2) You do not want just the [L] as that will result in an internal redirect invisible to the end user (not caused by the L, the default action "" is an internal redirect). RedirectPermanent generates a 3xx response to the end user. You could add the L, i.e., [R=permanent,L] to stop mod_rewrite from processing any more rules.