我想将请求传递到我的域到另一个域,该域由主机安全地处理,然后使用ssl指回该请求。我的htaccess文件如下所示:
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]
但我收到错误:
This page is redirected in a loop (my own translation to english)
我做错了什么,我该怎么办?
答案 0 :(得分:1)
您的RewriteCond
重定向规则需要额外https
:
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]