I do not know about “Redirect 301”, but here is what I use:
RewriteEngine on
RedirectMatch 301 ^/oldpage$ https://mysite.com/newpage/
I do not think it really matters where a redirect is placed, but I have them near the top:
# BEGIN WordPress
ServerSignature Off
AddHandler application/x-httpd-php54s .php
Options -Indexes
DirectoryIndex index.php index.html /index.php
### added redirects
RewriteEngine on
RedirectMatch 301 ^/oldpage$ https://mysite.com/newpage/
.............
OK, Thanks for a very clear answer.
one more. do I have to end the statement with
RewriteEngine off
?
I have never seen “RewriteEngine off” anywhere, but I did find this just a moment ago:
http://www.helicontech.com/isapi_rewrite/doc/RewriteEngine.htm
Thanks for that. I suppose you are saying it also works without. However would it be better with?
I would guess it is best to just leave it on unless there is a specific need to turn it off. If it is already on, each new re-encounter of “RewriteEngine on” is simple redundant, but actually turning it off and then back on again would add load to the server.
Good info and thank you for helping out a beginner.
I started a new post for clarity as I still get an error by my 301 setup. could you have a look please if you see why I did wrong?
http://wordpress.org/support/topic/changing-url-with-htacess-301-stll-gets-404?replies=1
Thanks.