Is it possible to redirect from Site A to site B all the URLs and subdomains except the index.php of site A. I used the below rules but none worked.
below is what i used to redirect all except the index
RewriteEngine On
RewriteCond %{HTTP_HOST} ^abc.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.abc.com$
RewriteCond %{REQUEST_URI} ! ^/index.php\
RewriteRule (.*)$ https://www.newsite.com/$1 [R=301,L]
Currently I m redirecting everything from site A to site B by using code which is working fine with below rule
RewriteEngine On
RewriteCond %{HTTP_HOST} ^abc.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.abc.com$
RewriteRule (.*)$ https://www.newsite.com/$1 [R=301,L]
how can i rewrite it in such a way that site A's index.php open the same as it is and everything else from site A redirects to site B.
I tried with the one it still doesnt work. everything is going to site b. And index,php of site A is the same ie www.abc.com I want this to open as it is. But www.abc.com/anything to the site B
Thanks
Try with below rule, I made an exception in your current rule to ignore only index.php and accept every other matches.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^abc.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.abc.com$
RewriteRule (.*)$ https://www.newsite.com/$1 [R=301,L]
Your previous attempt regardless matching everything.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.