【问题标题】:Setting SSL for a few pages为几个页面设置 SSL
【发布时间】:2015-02-09 17:49:54
【问题描述】:

目前,我网站上的所有内容都重定向到 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}

【问题讨论】:

    标签: php html .htaccess ssl


    【解决方案1】:

    您可以在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$
    

    【讨论】:

      猜你喜欢
      • 2011-09-27
      • 2010-09-16
      • 2012-12-31
      • 2022-08-10
      • 2020-04-22
      • 2011-07-09
      • 1970-01-01
      • 2016-01-22
      • 2023-03-27
      相关资源
      最近更新 更多