0

谷歌云上的 Bitnami wordpress。

好的,下面的代码将所有内容转移到 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>
4

1 回答 1

0

Bitnami 工程师在这里。

从您在此处共享的配置文件中,在我看来您正试图将所有传入请求重定向到https://example.co.uk,这是真的吗?

为此,您可以编辑/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]
...

更多信息在这里:

https://docs.bitnami.com/google/components/apache/#how-to-access-my-application-from-only-one-domain

于 2018-07-24T11:36:22.533 回答