将http重定向到https会在.com apache之后删除斜杠

时间:2017-10-30 19:52:49

标签: apache .htaccess redirect mod-rewrite

http link of page 重定向删除.com后的/

https link of page but without / after .com

我正在使用带有apache的VPS,并在我的.htaccess文件中包含以下代码。

RewriteEngine On
# This will enable the Rewrite capabilities

RewriteCond %{HTTPS} !=on
# This checks to make sure the connection is not already HTTPS

RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]
# This rule will redirect users from their original location, to the same location but using HTTPS.
# i.e.  http://www.example.com/foo/ to https://www.example.com/foo/
# The leading slash is made optional so that this will work either in httpd.conf
# or .htaccess context

1 个答案:

答案 0 :(得分:1)

<VirtualHost *:80>

Redirect permanent / https://ampletrails.com

应该是

Redirect permanent / https://ampletrails.com/