【问题标题】:.htaccess rewriterule with ssl.htaccess 使用 ssl 重写
【发布时间】:2016-02-14 02:34:46
【问题描述】:

我有这样的 .htaccess 文件:

RewriteEngine On
RewriteRule  ^i/(.+)$ indexa.php?variable=$1

我是这样的重定向网址http://www.sitename.com/i/pages.html

通过这种重定向,我将 i/ 之后的所有内容都写入变量。没有任何问题。 (服务器上不存在 i/ 文件夹)。

但是我在我的服务器上安装了 SSL,现在我收到错误 404,该文件在服务器上找不到。我在谷歌上搜索了一天,仍然没有找到答案。

这也是我的 000-default.conf 文件

<VirtualHost *:443>
 ServerName example.com
 DocumentRoot /var/www
 SSLEngine on
 SSLCertificateFile /root/example.crt
 SSLCertificateKeyFile /root/example.key
 SSLCACertificateFile /root/ssl-bundle.crt
 ErrorLog ${APACHE_LOG_DIR]/error.log
 CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

【问题讨论】:

    标签: .htaccess mod-rewrite ssl


    【解决方案1】:

    我加了

    <Directory /var/www>
    RewriteEngine On
    RewriteRule  ^i/(.+)$ indexa.php?variable=$1
    </Directory>
    

    进入我的 000-default.conf 文件,然后运行以下命令:

    sudo a2enmod rewrite
    

    现在一切正常。如果我遇到任何其他问题,我会更新我的问题和答案。

    【讨论】:

      猜你喜欢
      • 2016-10-28
      • 2011-01-27
      • 2010-12-03
      • 1970-01-01
      • 2016-12-20
      • 2012-07-30
      • 2014-02-22
      • 2011-04-04
      • 2018-01-31
      相关资源
      最近更新 更多