为几页设置SSL

时间:2014-12-11 09:38:10

标签: php html .htaccess ssl

目前,我网站上的所有内容都重定向到https。这很棒。我很想用ssl。但是现在,并非所有东西都使用SSL,所以我想慢慢转移所有东西。所以我想要几页(register.html,register.php,textlimit.html,textlimit.php)。 非常感谢。

我的.htaccess目前正在

SetEnv TZ America/Los_Angeles

# Prevent viewing of htaccess file.
<Files .htaccess>
    order allow,deny
    deny from all
</Files>

# Prevent directory listings
Options All -Indexes

# Compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript


RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

1 个答案:

答案 0 :(得分:0)

您可以在RewriteCond %{HTTPS} off下面添加:

RewriteCond %{REQUEST_URI} ^/(?:register\.html|register\.php|textlimit\.html|textlimit\.php)$

如果您想稍后添加更多内容,请使用更简单的格式:

RewriteCond %{REQUEST_URI} ^/(?:register\.html|register\.php)$ [OR]
RewriteCond %{REQUEST_URI} ^/(?:textlimit\.html|textlimit\.php)$ [OR]
RewriteCond %{REQUEST_URI} ^/other\.html$ [OR]
RewriteCond %{REQUEST_URI} ^/other2\.html$