0

I have an old website where I need to redirect index.php to the root to prevent duplicate content. Normally I'd use the following:

RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php
RewriteRule ^index\.php$ / [L,R=301]

The problem is, I have some pages such as index.php?id=6, index.php?id=14 that I don't want redirecting to the root.

How could I amend the above .htaccess rule to exclude index.php files that contain these query strings?

Thanks,

Liam

1 Answer 1

1

You can add before RewriteRule:

RewriteCond %{QUERY_STRING} ^$
Sign up to request clarification or add additional context in comments.

Comments

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.