使用.htaccess和mod_rewrite将HTTPredirect到HTTP
我知道有大量的在线教程,并在这里发表有关使用.htaccess将HTTPredirect到HTTPS的信息。 但是,我的问题是关于在redirect期间将被改变的URL。 Apache2应该将“ http:// localhost /〜user / secure_secrets ” 转发到https:// localhost /〜user / secure_secrets “我已经安装了apache_2,并且使用userdir模块从用户的主目录中提供了public_html现在,在public_html ,我有一个名为“secure_secrets”的文件夹,这个URL指的是redirect,因此我设置了.htaccess: # Enable rewrite RewriteEngine on # Check if connection is not already HTTPS RewriteCond %{HTTPS} !=on RewriteRule ^/?secure_secrets/(.*) https://localhost/~user/secure_secrets/$1 [R,L] 但它不起作用。 当我在浏览器中inputHTTPurl时,说404找不到。 我想我在重写URL中指定HTTP URL时犯了一个错误,但是我不明白在哪里。 作为额外的信息,我的其他configuration是: 在/etc/apache2/sites-available/000-default.conf中: <Directory "/var/www/html"> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all […]