We updated Joomla 1.5 to 2.5 and a lot of links changed so we are doing 301 redirect in the htaccess; however i'm running into a bunch that are just not working.
redirect 301 /photos-a-movies/photos-of-old-friends/119-halloween/detail/946-604a927.html?tmpl=component http://www.handicappedpets.com/photos-a-movies/media-photos.html
redirect 301 /photos-a-movies/photos-of-old-friends/101-friends/detail/671-dcp0062.html?tmpl=component http://www.handicappedpets.com/photos-a-movies/media-photos.html
redirect 301 /photos-a-movies/photos-of-old-friends/101-friends/detail/1286-barks.html?tmpl=component http://www.handicappedpets.com/photos-a-movies/media-photos.html
Maybe its catching up on the crap at the end of the url? Either way...is there a way to 301 redirect say "/photos-a-movies/photos-of-old-friends" and no matter what is after it it gets redirected to a page? Or is there a reason why these 301's don't work?
EDIT:
ok I can get it to work if I do:
redirect 301 /photos-a-movies/photos-of-old-friends/101-friends/detail/1286-barks.html http://www.handicappedpets.com/photos-a-movies/media-photos.html
Instead of
redirect 301 /photos-a-movies/photos-of-old-friends/101-friends/detail/1286-barks.html?tmpl=component http://www.handicappedpets.com/photos-a-movies/media-photos.html
Redirects to http://www.handicappedpets.com/photos-a-movies/media-photos.html?tmpl=component
but it places the "?tmpl=component" at the end still. Is there a way to get rid of it?
The reason why your original redirects didn't work is because you can't match against the query string (the ?tmpl=component
part of the URI) in a Redirect
directive.
but it places the "?tmpl=component" at the end still. Is there a way to get rid of it?
You need to add a ?
at the end of the target URL:
http://www.handicappedpets.com/photos-a-movies/media-photos.html?
The problem with that is after the redirect, you have a stray ?
at the end. If you can't have that, then you'll need to use mod_rewrite instead:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^tmpl=component$
RewriteRule ^/photos-a-movies/photos-of-old-friends/101-friends/detail/1286-barks.html$ http://www.handicappedpets.com/photos-a-movies/media-photos.html? [L,R=301]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.