为什么uri路径没有被我的.htaccess重定向到index.php仅用于https / ssl?

时间:2014-02-20 16:26:04

标签: apache .htaccess ssl https xampp

当URL具有必须重定向到index.php以进行正确路由的uri路径时,我仅针对HTTP获得404错误。

示例:

200 => https://localhostcl.idinteractive.co/ 
200 => http://localhostcl.idinteractive.co/ 
200 => http://localhostcl.idinteractive.co/login 
404 => https://localhostcl.idinteractive.co/login (this should be redirect by the htaccess below to index.php). Why is it not?

浏览器说...

  

在此服务器上找不到请求的URL。关于的链接   引用页面似乎是错误的或过时的。请通知作者   关于错误的那个页面。

Apache错误日志说...

  

[Wed Feb 19 12:59:06] [错误] [客户端127.0.0.22]文件没有   存在:C:/ DATA / IDInteractive / IDdashboard / dev / cl / login

的.htaccess

AddDefaultCharset UTF-8
AddHandler x-mapp-php6 .php

<IfModule mod_rewrite.c>
    RewriteEngine On
    DirectoryIndex index.php
    RewriteBase /

    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !(^wwwroot.*)
    RewriteRule ^(.*)$ /index.php?/$1 [QSA,L]
    #RewriteRule ^(.*)$ /index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 index.html
</IfModule>

HTTP-vhost.conf

NameVirtualHost *:80
Listen *:80
<VirtualHost 127.0.0.22:80>
    <Directory "C:/DATA/IDInteractive/IDdashboard/dev/cl">
                AllowOverride All
                Options +Includes
                Allow from all
    </Directory>
    ServerAdmin xxx@taylormadetraffic.com
    DocumentRoot "C:/DATA/IDInteractive/IDdashboard/dev/cl"
    ServerPath "C:/DATA/IDInteractive/IDdashboard/dev/cl"
    ServerName localhostcl.idinteractive
    ServerAlias localhostcl.idinteractive.co
    ErrorLog "logs/idinteractive-error.log"
    CustomLog "logs/idinteractive-access.log" combined
        AddType application/x-httpd-php .php
        AddType application/x-mapp-php5 .php
        AddHandler application/x-mapp-php5 .php     
        AddHandler php-cgi .php
        AddHandler server-parsed .html
        AddHandler application/x-httpd-php .php .htm
</VirtualHost>

的httpd-ssl.conf中

<IfModule ssl_module>
NameVirtualHost *:443
Listen *:443

<IfModule mime_module>
    AddType application/x-x509-ca-cert .crt
    AddType application/x-pkcs7-crl    .crl
</IfModule>
SSLPassPhraseDialog  builtin
SSLMutex default
<VirtualHost 127.0.0.22:443>
    DocumentRoot "C:/DATA/IDInteractive/IDdashboard/dev/cl"
    ServerName localhostcl.idinteractive
    ServerAlias localhostcl.idinteractive.co
    ServerAdmin xxx@taylormadetraffic.com
    ErrorLog "logs/idinteractive-ssl-error.log"
    <IfModule log_config_module>
        CustomLog "logs/idinteractive-ssl-access.log" combined
    </IfModule>
    SSLEngine on
    SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
    SSLCertificateFile "conf/ssl.crt/server.crt"
    SSLCertificateKeyFile "conf/ssl.key/server.key"    
    <FilesMatch "\.(cgi|shtml|pl|asp|php)$">
        SSLOptions +StdEnvVars
    </FilesMatch>
    <Directory "C:/xampp/cgi-bin">
        SSLOptions +StdEnvVars
    </Directory>    
    BrowserMatch ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
    CustomLog "logs/ssl_request.log" "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
        AddType application/x-httpd-php .php
        AddType application/x-mapp-php5 .php
        AddHandler application/x-mapp-php5 .php     
        AddHandler php-cgi .php
        AddHandler server-parsed .html
        AddHandler application/x-httpd-php .php .htm    
</VirtualHost>  
</IfModule>

Windows主机文件:

127.0.0.22  localhostcl.idinteractive.co

1 个答案:

答案 0 :(得分:1)

您还需要在ssl vhost中包含<Directory>容器:

<Directory "C:/DATA/IDInteractive/IDdashboard/dev/cl">
            AllowOverride All
            Options +Includes
            Allow from all
</Directory>

否则{s} vhost中的AllowOverride将不会设置为All,但非SSL vhost中的 设置为。