I have problem with redirecting pages from old site which is Joomla to new site which isn't joomla. I have tried this
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^oldsite.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.oldsite.com$
RewriteRule (.*)$ http://newsite.com/$1 [R=301,L]
RewriteRule ^/page http://newsite.com/pgs/page [R=301,L]
^ this redirect to newsite.com/page instead of newsite.com/pgs/page
RewriteRule ^/anotherpage http://www.newsite.com/cat/sub/sub-sub/productindex.php [R=301,L]
^ this redirect to newsite.com/anotherpage
As you can see it's redirecting only to root/page ... doesn't get sub pages etc. Can anyone help with this?
How to make it if I have 2 or 3 different old url's leading to same new url? like this one:
RewriteRule ^/?oldpage http://www.newsite\.com/pgs/services/index.php [R=301,L,NC]
RewriteRule ^/?oldpage2 http://www.newsite\.com/pgs/services/index.php [R=301,L,NC]
RewriteRule ^/?oldpage3 http://www.newsite\.com/pgs/services/index.php [R=301,L,NC]
Have it this way by reordering your rules:
RewriteEngine On
RewriteRule ^/?anotherpage http://www.newsite.com/cat/sub/sub-sub/productindex.php [L,NC,R=301]
RewriteRule ^/?page http://newsite.com/pgs/page [R=301,L,NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?oldsite\.com$ [NC]
RewriteRule ^ http://newsite.com%{REQUEST_URI} [R=301,L,NE]
Make sure to clear browser cache before testing these rules.