2014-02-20 30 views
1

當URL有一個uri路徑必須被重定向到index.php才能正確路由時,我只爲HTTP獲取404錯誤。爲什麼uri路徑只能通過https/ssl的.htaccess重定向到index.php?

例子:

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的錯誤日誌說...

[星期三2月19日12時59分06秒2014] [錯誤] [客戶端127.0.0.22]文件不存在 :C:/ DATA/IDInteractive/IDdashboard的/ dev/CL /登錄

的.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 [email protected] 
    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 [email protected] 
    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 
+0

「login」是一個目錄嗎? – anubhava

回答

1

您需要包括<Directory> y中的容器我們的SSL虛擬主機,以及:

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

否則AllowOverride不會被設置爲All在SSL虛擬主機,但它是在非SSL虛擬主機集。

+0

謝謝SOOOO @JonLin –

相關問題