Reputation: 5201
I want to pass the request to my domain to another domain that is securly handled by host that points that request back but with ssl. My htaccess file looks like this:
Options +FollowSymLinks
AddDefaultCharset UTF-8.
RewriteEngine On
DirectoryIndex default.php
# checking that the request is not directory or file
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ https://securedomain.com%{REQUEST_URI} [R=301]
RewriteRule ^admin[/]?$ /admin/login [redirect]
RewriteRule ^admin/([a-zA-Z]+)/?([a-zA-Z0-9/]*)$ /public/admin/index.php?page=$1&query=$2 [L]
RewriteRule ^([a-zA-Z]+)/?([a-zA-Z0-9/]*)$ /public/index.php?page=$1&query=$2 [L]
But I get the error:
This page is redirected in a loop (my own translation to english)
What am i doing wrong, and what should I do?
Upvotes: 0
Views: 44
Reputation: 785266
You need an additional RewriteCond
in your https
redirecting rule:
RewriteEngine On
DirectoryIndex default.php
# checking that the request is not directory or file
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTPS} off
RewriteRule ^ https://securedomain.com%{REQUEST_URI} [R=301,L,NE]
RewriteRule ^admin/?$ /admin/login [L,R]
RewriteRule ^admin/([a-zA-Z]+)/?([a-zA-Z0-9/]*)$ /public/admin/index.php?page=$1&query=$2 [L]
RewriteRule ^([a-zA-Z]+)/?([a-zA-Z0-9/]*)$ /public/index.php?page=$1&query=$2 [L]
Upvotes: 1