Forum Moderators: phranque
Redirect /folder/subfolder http://example.com/some-folder [L,R=301]
RewriteRule /folder?(.*) http://example.com/different-folder [R=301,L] Thanks!
[edited by: jdMorgan at 1:12 pm (utc) on Oct. 27, 2009]
[edit reason] example.com [/edit]
You've further complicated things by using directives from two completely-different Apache modules, mod_alias and mod_rewrite. Your syntax for the Redirect directive is incorrect, and I'd strongly suggest that you take a look at the Apache documentation for both modules.
As written, your RewriteRule directive will affect *any* URL that *contains* "/folder" or "/folde", and so will always affect the same URLs (and more) that your Redirect directive affects. I suspect that you'll be much happier with more-specific and better-anchored patterns, and attention to the required syntax for each directive.
Jim
[example-old.com...] needs to map to [example-new.com...]
but
[example-old.com...] needs to map to [example-new.com...]
and
[example-old.com...] needs to map to [example-new.com...]
So I suppose this translates to something like this?
RewriteCond %{REQUEST_URI} ^press-center(.*)
RewriteCond %{REQUEST_URI} !^press-center/press-releases/?$
RewriteRule ^$ http://example-new.com/media? [L]Redirect /press-center/press-releases http://example-new.com/media/press? [R=301,L]
Thanks!
RewriteRule ^press-center/press-releases/?$ http://example-new.com/media/press? [R=301,L]
#
RewriteRule ^press-center(/.*)?$ http://example-new.com/media? [R=301,L]
I assume that you added the "?" to both substitution URLs in order to remove any query strings from the requested URLs, although that is *not* what would happen were you to continue to use a mod_alias "Redirect" directive. I have reproduced that feature here.
Jim