【问题标题】:How do you rewrite http to https for an addon domain in htaccess如何在 htaccess 中为插件域将 http 重写为 https
【发布时间】:2015-05-29 02:58:00
【问题描述】:

我在 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>

【问题讨论】:

    标签: .htaccess


    【解决方案1】:

    使用控制面板,尤其是 cpanel 可以控制服务器并配置与标准设置大不相同的东西。无论如何,您可能需要向您的插件域添加一个重写库。在插件域的 .htaccess 中,将 rewritebase 更改为您的插件文件夹。

    RewriteBase /target_directory
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-18
      • 1970-01-01
      • 1970-01-01
      • 2015-01-10
      相关资源
      最近更新 更多