I got the following htaccess that ends up in a redirection loop:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/int(.*)$
RewriteRule ^(.*)$ /int [R,L]
RewriteRule . index.php [L]
I added the first rule to redirect root requests to a specific sub folder. The second rule comes from WordPress (among others)
I dont see why this should end in a redirection loop. Does the second rewrite trigger another request so that the htaccess is checked again? Thant would explain the loop.
Thank you
Each of your rewrites creates a new request which is reprocessed through the .htaccess.
You're rewriting anything doesn't start with /int(.*) to /int. However, anything that starts with /int skips the first rewrite condition and gets rewritten to index.php. Then index.php gets rewriten to /int because it doesn't start with /int(.*). Then /int gets rewritten to index.php... and on ...and on...
BTW: You could prevent the endless loop by adding a second rewrite condition to not trigger your first rewrite rule to when the REQUEST_URI is /index.php
RewriteCond %{REQUEST_URI} !^/index.php$
RewriteCond %{REQUEST_URI} !^/int(.*)$
RewriteRule ^(.*)$ /int [R,L]
If forget if you need the leading forward slash in the first rewite condition... try it both ways.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With