https与url重写

时间:2014-12-31 13:46:01

标签: apache .htaccess https

当我在我的网站上启用https时,网址重写不起作用(找不到...) 我的htaccess:

# URL Rewrite
<IfModule mod_rewrite.c>
    RewriteEngine On

    #  Full path to your site
    #
    RewriteBase /           

    # 301 redirect if missing www.
    #RewriteCond %{HTTP_HOST} !^www\.
    #RewriteRule ^(.*)$ https://www.% {HTTP_HOST}/$1 [R=301,L]
    #RewriteRule ^(static/|ajax\.php) - [F,L,NC]

    # 301 redirect if missing trailing slash
    #RewriteCond %{REQUEST_FILENAME} !-f
    #RewriteCond %{REQUEST_FILENAME} !-d
    #RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L]

    #  Rules
    #
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*) index.php?do=/$1

</IfModule>

如何通过网址重写启用https?

2 个答案:

答案 0 :(得分:1)

AllowOverride None条目中有<Directory /var/www/>,表示.htaccess未启用。

启用.htaccess将其更改为:

AllowOverride All

重新启动Apache服务器。

答案 1 :(得分:-1)

你需要首先取消对这些行的注释。

相关问题