0

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.

3
  • Why does it matter? They both go to the same place. The main benefit of having index.whatever files is that they aren't required in URLs. Commented Nov 23, 2016 at 5:09
  • no it doesn't submit a contact us form if it doesn't contain index.php @Walf Commented Nov 23, 2016 at 15:15
  • Does the contact form submit to /index.php?... imstead of /?...? If so, change it. You shouldn't be redirecting POST requests, either, so add a RewriteCond to ensure only GET or HEAD requests get redirected. Commented Nov 23, 2016 at 21:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.