.htaccess 将*example.com/*重定向到https://example.com/*
我的URL前面有一个没有“www”的SSL证书,当用户从http切换到https时,我遇到Javascript的同源策略问题 我想知道如何(键入什么.htaccess?)重定向所有内容(.htaccess 将*example.com/*重定向到https://example.com/*,.htaccess,mod-rewrite,redirect,ssl,https,.htaccess,Mod Rewrite,Redirect,Ssl,Https,我的URL前面有一个没有“www”的SSL证书,当用户从http切换到https时,我遇到Javascript的同源策略问题 我想知道如何(键入什么.htaccess?)重定向所有内容(http://www.example.com, http://example.com,及https://www.example.com)至https://example.com 此外,我还想查看在我的URL之后键入的任何内容(*example.com/*) 也可以在键入URL之前使用https重定向。(https
http://www.example.com, http://example.com,及https://www.example.com
)至https://example.com
此外,我还想查看在我的URL之后键入的任何内容(*example.com/*
)
也可以在键入URL之前使用https重定向。(https://example.com/[键入的内容]
)
谢谢 将此代码放入您的
文档\u ROOT/.htaccess
文件:
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^ https://example.com%{REQUEST_URI} [NE,R=301,L]
杰出的你给我的代码正好满足了我的需要。为了提醒其他人,我在单独的位置(DOCUMENT\u ROOT/example目录)中有额外的.htacesss文件,我需要删除这些文件,因为它们覆盖了您的代码。