Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess https破坏了重写规则_.htaccess_Ssl - Fatal编程技术网

.htaccess https破坏了重写规则

.htaccess https破坏了重写规则,.htaccess,ssl,.htaccess,Ssl,我遇到了一些.htaccess重定向问题 主要是我不关心用户是否使用https,除非我将他们发送到那里,我已经找到了很多关于如何强制使用https的资源,但这不是我想要做的 这是我的htaccess的一个示例: Options -Indexes Options -MultiViews <filesMatch "\.(html|htm|txt|js|htaccess)$"> FileETag None <ifModule mod_headers.c>

我遇到了一些.htaccess重定向问题

主要是我不关心用户是否使用https,除非我将他们发送到那里,我已经找到了很多关于如何强制使用https的资源,但这不是我想要做的

这是我的htaccess的一个示例:

Options -Indexes
Options -MultiViews

<filesMatch "\.(html|htm|txt|js|htaccess)$">
FileETag None
    <ifModule mod_headers.c>
        Header unset ETag
        Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
        Header set Pragma "no-cache"
        Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
    </ifModule>
</filesMatch>

ErrorDocument 404 /404.php 

RewriteEngine On

#RewriteCond %{HTTPS} !=on
#RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

#Main site rules
RewriteRule    ^about/?$     about.php    [NC,L]
但是重定向到about.php的示例规则不起作用

如何在重定向中允许https

我还试验了:

Define servername www.example.com
Define SSL

但我不理解它的功能或实现

当您取消对HTTPS规则的注释时,
/about
URI会遇到什么问题?如果我取消对HTTPS的注释,我会成功地被强制进入
HTTPS
,但是当我访问
/about
时,它会说在服务器上找不到
/about
,如果您尝试打开
https://domain.com/about.php
在浏览器中(为了绕过这两条规则)?如果我直接导航到这些文件,我就能访问它们。好的,
https://domain.com/about
URI?
Define servername www.example.com
Define SSL