.htaccess htaccess-HTTPS的IP规范化

.htaccess htaccess-HTTPS的IP规范化,.htaccess,redirect,https,google-cloud-platform,bitnami,.htaccess,Redirect,Https,Google Cloud Platform,Bitnami,谷歌云上的BitnamiWordPress 好的,下面的代码将所有内容转移到https非www上,这非常有效,但问题是我们无法将专用IP重定向到https url。请参阅下文 RewriteEngine on <ifModule mod_rewrite.c> RewriteBase / # IP REDIRECT CONANIZATION RewriteCond %{HTTP_HOST} ^00\.00\.93\.114$ RewriteRule ^(.*)$ https://

谷歌云上的BitnamiWordPress

好的,下面的代码将所有内容转移到https非www上,这非常有效,但问题是我们无法将专用IP重定向到https url。请参阅下文

RewriteEngine on


<ifModule mod_rewrite.c>
RewriteBase /

# IP REDIRECT CONANIZATION
RewriteCond %{HTTP_HOST} ^00\.00\.93\.114$
RewriteRule ^(.*)$ https://example.co.uk/$1 [L,R=301]


### WORKING HTTP to HTTPS / NON-WWW - WORKS

#if not example.co.uk then redirect to example.co.uk
RewriteCond %{HTTP_HOST} !^example\.co.uk$ [NC]
RewriteRule .* http://example.co.uk%{REQUEST_URI} [L,R=301]

#if not https
RewriteCond %{HTTPS} off
#redirect to https
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

</IfModule>
重新编写引擎打开
重写基/
#IP重定向网络化
重写cond%{HTTP_HOST}^00\.00\.93\.114$
重写规则^(.*)$https://example.co.uk/$1[L,R=301]
###工作HTTP到HTTPS/非WWW-工作
#如果不是example.co.uk,则重定向到example.co.uk
重写cond%{HTTP_HOST}^示例\.co.uk$[NC]
重写规则。*http://example.co.uk%{REQUEST_URI}[L,R=301]
#如果不是https
重写条件%{HTTPS}关闭
#重定向到https
重写规则。*https://%{HTTP_HOST}%{REQUEST_URI}[L,R=301]

Bitnami工程师在这里

从您在这里共享的配置文件来看,您似乎试图将所有传入请求重定向到,这是真的吗

为此,您可以编辑
/opt/bitnami/apache2/conf/bitnami/bitnami.conf
文件并设置以下行

<VirtualHost _default_:80>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^example.co.uk$
RewriteCond %{HTTP_HOST} !^(localhost|127.0.0.1)
RewriteRule ^(.*)$ https://example.co.uk$1 [R=permanent,L]
...

<VirtualHost _default_:443>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^example.co.uk$
RewriteCond %{HTTP_HOST} !^(localhost|127.0.0.1)
RewriteRule ^(.*)$ https://example.co.uk$1 [R=permanent,L]
...

重新启动发动机
重写cond%{HTTP_HOST}^example.co.uk$
重写cond%{HTTP_HOST}^(localhost | 127.0.0.1)
重写规则^(.*)$https://example.co.uk$1[R=永久性,L]
...
重新启动发动机
重写cond%{HTTP_HOST}^example.co.uk$
重写cond%{HTTP_HOST}^(localhost | 127.0.0.1)
重写规则^(.*)$https://example.co.uk$1[R=永久性,L]
...
更多信息请点击此处: