HTaccess MOD_REWRITE Collision OF RULES: Force HTTPS & SEO Friendly

Hello fellas!

Im planning to force HTTPS and handle all SEO friendly URLs with index.php, but both rules seem to collide.

Chrome runs a 302 “Found” error when I add these two lines:

RewriteCond %{HTTP_HOST} !^ssl\.mydomain\.org$
RewriteRule ^(.*){REQUEST_URI}

Here is the full htaccess

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{HTTP_HOST} !^ssl\.mydomain\.org$
RewriteRule ^(.*){REQUEST_URI}

RewriteRule ^contacto$ /contacto.php [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ /index.php


Can you help me? Im quite confused and I think that Im missing the correct order of rules.

Unless I’m missing something, aren’t you setting up an infinite redirect loop here? If the hostname isn’t then you’re redirecting to, which doesn’t match so then the request gets stuck in an infinite loop.

I would guess you want something like:

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.