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?
Redirect
is a mod_alias directive, not mod_rewrite, and has nothing to do with theRewriteEngine
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:
Any mod_rewrite directives in child
.htaccess
files (eg./wp/.htaccess
) will completely override this directive in the root.htaccess
file (by default).