Which redirect rule would I use to redirect all pages under olddomain.example
to be redirected to newdomain.example
?
The site has a totally different structure, so I want every page under the old domain to be redirected to the new domain index page.
I thought this would do (under olddomain.example base directory):
RewriteEngine On
RewriteRule ^(.*)$ http://newdomain.example/ [R=301]
But if I navigate to olddomain.example/somepage
I get redirected to newdomain.example/somepage
. I am expecting a redirect only to newdomain.example
without the page suffix.
How do I keep the last part out?
RewriteEngine on
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [R=301,L]
* stackoverflow.com/a/7578810/1066234htaccess tutorial
, you can find it on the following link helponnet.com/2021/04/15/htaccess-tutorial-for-beginers