apache修改.htaccess
复制内容到剪贴板
代码:
RewriteRule ^(.*) https://域名.com/$1 [R,L]
nginx修改nginx.conf
复制内容到剪贴板
代码:
server {
listen 80;
server_name 域名.com www.域名.com;
index index.html index.htm index.php;
root /home/htdocs;
rewrite ^/(.*)$ https://$host/$1 permanent;
}
server
{
listen 443;
server_name 域名.com;
index index.html index.htm index.php;
root /home/htdocs;
ssl on;
ssl_certificate /证书.crt;
ssl_certificate_key /证书.key;
ssl_session_timeout 10m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;
fastcgi_param HTTPS on;
}