How to redirect index.php to root in htaccess with exception

249 Views Asked by At

I have a site and I want to do .htaccess rewrite to redirect all site from /index.php to /, but except /contact-us page.

So how can I add an exception to this:

RedirectMatch 301 /index.php/(.*) $1
RewriteRule ^index\.php$ / [R=301,L]
RewriteRule ^(.*)/index\.php$ /$1/ [R=301,L]

So that when I enter:

index.php?option=com_baforms&view=form&form_id=1

It doesn't redirect to:

?option=com_baforms&view=form&form_id=1

I saw this post, but I wasn't able to do it myself.

0

There are 0 best solutions below