I want to make a redirect 301 from an old ulr to a new url.
old url: /php/zend-framework/captcha-codigo-anti-spam-zend-framework
new url: http
It looks like both URI's are on the same host (www.demo31.com
), so when you use RedirectMatch
, the part of the URI that matches is part of the redirect. Example
If I go to:
http://www.demo31.com/php/zend-framework/captcha-codigo-anti-spam-zend-framework
/php/zend-framework/captcha-codigo-anti-spam-zend-framework
The RedirectMatch
directive matches the URI, redirects to:
http://www.demo31.com/blog/php/zend-framework/captcha-codigo-anti-spam-zend-framework
/blog/php/zend-framework/captcha-codigo-anti-spam-zend-framework
RedirectMatch
directive matches the URI again since it contaings /php/zend-framework/captcha-codigo-anti-spam-zend-framework
Try changing RedirectMatch
to just Redirect
. Or if you only want that specific URI to redirect (as opposed to something like /php/zend-framework/captcha-codigo-anti-spam-zend-framework/some/other/stuff
also getting redirected, add a few delimiters:
RedirectMatch 301 ^/php/zend-framework/captcha-codigo-anti-spam-zend-framework$ http://www.demo31.com/blog/php/zend-framework/captcha-codigo-anti-spam-zend-framework
(the ^
and $
RewriteRule ^bad_url$ good_url [R=301,L]
Thx ! works for me