復制代碼 代碼如下:
<Directory "/opt/fivetrees">## Possible values for the Options directive are "None", "All",# or any combination of:# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews## Note that "MultiViews" must be named *explicitly* --- "Options All"# doesn't give it to you.## The Options directive is both complicated and important. Please see# http://httpd.apache.org/docs/2.2/mod/core.html#options# for more information.#Options FollowSymLinks## AllowOverride controls what directives may be placed in .htaccess files.# It can be "All", "None", or any combination of the keywords:# Options FileInfo AuthConfig Limit#AllowOverride All #這里原先是None要改為All## Controls who can get stuff from this server.#Order allow,denyAllow from all</Directory>首先,在網站根目錄下創建.htaccess文件,在最下面添加寫入如下語句:
復制代碼 代碼如下:
RewriteEngine onRewriteBase / #我這行是沒有配置RewriteCond %{SERVER_PORT} !^443$RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]新聞熱點
疑難解答