.htaccess - htaccess redirect with RedirectMatch -


i'm adding 301 redirect website, here htaccess content :

    redirectmatch ^/gift/birthday/(.*) /gifts.html 

the result in browser :

    http://www.website.com/gifts.htmlbirthday/  

and want :

    http://www.website.com/gifts.html 

how can ?

edit : htaccess :

<ifmodule mod_rewrite.c>  options +followsymlinks rewriteengine on  rewriterule ^api/rest api.php?type=rest [qsa,l]  rewriterule .* - [e=http_authorization:%{http:authorization}]  rewritecond %{request_method} ^trac[ek] rewriterule .* - [l,r=405]  rewritecond %{request_uri} !^/(media|skin|js)/   rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{request_filename} !-l  rewriterule .* index.php [l]  redirectmatch ^/gift/birthday/(.*) /gifts.html </ifmodule> 

don't mix mod_rewrite rules , mod_alias directives this, not processed in order .htaccess, separately handled different apache modules.

what need this:

# not mod_rewrite rule can outside ifmodule options +followsymlinks  # mod_rewrite rules go here <ifmodule mod_rewrite.c>  # initialize mod_rewrite rewriteengine on rewritebase /  # redirect rewriterule ^gift/birthday/  http://www.website.com/gifts.html [r=301,l]  # copy&paste rest of htaccess below, delete redirectmatch line # ... 

this rewriterule 301 redirect url starts gift/birthday/ fixed url /gifts.htm. letter [l] means skip rest of rules if 1 matched.

don't forget close set of rules < /ifmodule > @ end.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -