So on my site, my shopping cart is located at example.com/zc2.

I use this .htaccess file:

RewriteEngine On

Redirect /index.html https://example.com/zc2/

So that anyone that lands on example.com will be redirected to my shopping cart.

All good, but now if I try and install WordPress at example.com/wp then browsers get stuck in a redirect loop.

I am positive it is my badly crafted .htaccess file.

What can I do to fix this?

1 Answer 1

Redirect /index.html https://example.com/zc2/

Redirect is a mod_alias directive, not mod_rewrite, and has nothing to do with the RewriteEngine directive (which enables the mod_rewrite rewriting engine) that precedes it.

However, whilst the Redirect directive in the root .htaccess file is likely to conflict with other .htaccess files (eg. WordPress), it's not clear why this would specifically trigger a redirect loop. (You should observe the network traffic to see exactly the nature of this "loop".)

However, you can minimise conflicts by changing this rule to use mod_rewrite instead. For example:

RewriteEngine On
RewriteRule ^(index\.html)?$ https://example.com/zc2 [R,L]

Any mod_rewrite directives in child .htaccess files (eg. /wp/.htaccess) will completely override this directive in the root .htaccess file (by default).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.