2017-06-04 67 views
0

我遇到了与用户in this thread.相同的问题我基本上想要使用htaccess将所有http请求重定向到https,而不使用www。使用URI重定向到HTTPS而没有www

我已经实施了一个solution to this problem,它做得很好。

但是,它不会重定向到相应的URI。如果我访问我的网站在端口80 example.com/news我将被重定向到https://example.com/index.php这基本上是根页..

我真的需要你的帮助球员,我完全没有关于htaccess的线索..

编辑这是我的mod_rewrite的样子..

<IfModule mod_rewrite.c> 
    <IfModule mod_negotiation.c> 
     Options -MultiViews 
    </IfModule> 

    RewriteEngine On 

    # Redirect Trailing Slashes If Not A Folder... 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)/$ /$1 [L,R=301] 

    # Handle Front Controller... 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteRule^index.php [L] 

    # Handle Authorization Header 
    RewriteCond %{HTTP:Authorization} . 
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 

    RewriteCond %{HTTPS} off 
    # First rewrite to HTTPS: 
    # Don't put www. here. If it is already there it will be included, if not 
    # the subsequent rule will catch it. 
    RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 
</IfModule> 
+0

那么,如果你没有发布你的动态配置文件的当前代码,那么你希望我们如何提供帮助? – arkascha

+0

@arkascha我更新了我的帖子。 – Dean

+0

问题_probably_是您首先重写为'index.php',然后_then_进行外部重定向。尝试改变规则的顺序。请注意,'L'标志仅终止了_current_遍历规则集。之后重新启动。 – arkascha

回答

0

问题可能是你第一次改写为index.php然后再做一个外部重定向。尝试改变规则的顺序。请注意,L标志仅终止当前遍历规则集。之后重新启动。所以做外部方向切换到https协议,然后做内部重写,如果更正。

相关问题