Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.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 如何将htaccess中的附加域的http重写为https_.htaccess - Fatal编程技术网

.htaccess 如何将htaccess中的附加域的http重写为https

.htaccess 如何将htaccess中的附加域的http重写为https,.htaccess,.htaccess,我在Godaddy有一个cPanel托管帐户,带有用于加载域的SSL。我需要将http重写为https。问题是所有重写方法都是从webroot加载的,而不是包含索引的文件夹,甚至是具有重写规则的htaccess。我知道在这个论坛上已经有关于这个的话题了,但是我已经尝试了那些建议的解决方案,这就是我在代码引用中看到的,但是它们不起作用。请不要随意关闭此线程 webroot (loading this content / not desired) | target_dire

我在Godaddy有一个cPanel托管帐户,带有用于加载域的SSL。我需要将http重写为https。问题是所有重写方法都是从webroot加载的,而不是包含索引的文件夹,甚至是具有重写规则的htaccess。我知道在这个论坛上已经有关于这个的话题了,但是我已经尝试了那些建议的解决方案,这就是我在代码引用中看到的,但是它们不起作用。请不要随意关闭此线程

webroot (loading this content / not desired)
      |
       target_directory (htaccess & SSL in question)
以下是本文发表时的完整htaccess

RewriteEngine On
RewriteBase /

RewriteCond %{HTTPS} off
#RewriteRule (.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
RewriteRule (.*)$ https://emeraldcoast\.rocks/$1 [R,L]

RewriteRule ^([a-zA-Z0-9\-_]+)$ index.php?page=$1
RewriteRule ^([a-zA-Z0-9\-_]+)/$ index.php?page=$1

<filesMatch ".(xml|txt|html|js|css)$">
ExpiresDefault A7200
Header append Cache-Control "max-age=290304000, public"
</filesMatch>
<filesMatch ".(xml|txt|html|php)$">
AddDefaultCharset utf-8
</filesMatch>
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</ifmodule>

使用控制面板(尤其是cpanel)可以控制服务器,并配置与标准设置不同的内容。无论如何,您可能需要将rewritebase添加到插件域。插件域的Inside.htaccess将rewritebase更改为您的插件文件夹

RewriteBase /target_directory