简体   繁体   English

您如何将(www.)查询重定向到非 www url 同时仍然强制 https://

[英]How would you redirect a (www.) query to the non-www url while still forcing the https://

Here is my .htaccess file from a managed Wordpress site on Go Daddy.这是我的 .htaccess 文件,来自 Go Daddy 上的托管 Wordpress 站点。 The middle section was added by a popular Wordpress plugin (Really Simple SSL) to force any http:// request to the https:// protocol, but if I input www.my_domain.com into the address bar of any major browser, the unsecure (non SSL) page version will render. The middle section was added by a popular Wordpress plugin (Really Simple SSL) to force any http:// request to the https:// protocol, but if I input www.my_domain.com into the address bar of any major browser, the将呈现不安全(非 SSL)页面版本。 Is there a bit of additional code that would force the www.是否有一些额外的代码会强制 www. to the secure https:// page?到安全的 https:// 页面?

# BEGIN GD-SSL
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_USER_AGENT} ^(.+)$
RewriteCond %{SERVER_NAME} ^vxj\.f09\.myftpupload\.com$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
Header add Strict-Transport-Security "max-age=300"
Header always set Content-Security-Policy "upgrade-insecure-requests"
</IfModule>
# END GD-SSL

# BEGIN rlrssslReallySimpleSSL rsssl_version[5.2.3]
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
</IfModule>
# END rlrssslReallySimpleSSL

# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

This posted question is no longer an issue -- after flushing my Wordpress cache, the .htaccess file is redirecting all requests (www.) to the https:// rendering.这个发布的问题不再是问题——刷新我的 Wordpress 缓存后,.htaccess 文件将所有请求(www.)重定向到 https:// 渲染。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM