2016-01-27 29 views
0

我們的開發環境在工作時使用帶apache/php的單個centos機器,爲CIFS掛載的和本地目錄提供不同的虛擬主機。我們的應用程序使用CodeIgniter的2.0CodeIgniter路由通過CIFS掛載工作,但不通過本地文件

我們最近做了一個改變我們的路線是爲服務安裝的驅動器上的虛擬主機工作正常建,但是路線不能被解析爲本地文件,造成404

$config['base_url'] = "http://production.host.com"; // the production value of $_SERVER['SERVER_NAME'] essentially 

路線:

$route['companyone'] = 'sso/platformsso/requestgenericsso/companyone'; 
$route['companyone/(:any)'] = 'sso/ptlatformsso/requestgenericsso/companyone/$1'; 

這適用於以下情形:

<VirtualHost 192.168.1.1:80> 
    ServerAdmin [email protected] 
    DocumentRoot "/var/mnt/a" 
    ServerName "a.tmbc.com" 
    ErrorLog logs/a.error.log 
    Alias ssaml /var/simplesamlphp/www 
</VirtualHost> 
<Directory "/var/mnt/a"> 
    Options FollowSymLinks 
    AllowOverride All 
    Order allow,deny 
    Allow from all 
</Directory> 

Directory populated using CIFS mount: mount -t cifs //1.2.3.4/a /var/mnt/a -o rw,username=un,password=pwd,uid=48 --verbose1 

但這種情況下不工作:

<VirtualHost 192.168.1.1:80> 
    ServerAdmin [email protected] 
    DocumentRoot "/var/www/html/b" 
    ServerName "b.host.com" 
    ErrorLog logs/b.error.log 
    Alias ssaml /var/simplesamlphp/www 
</VirtualHost> 
<Directory "/var/www/html/b"> 
    Options FollowSymLinks 
    AllowOverride All 
    Order allow,deny 
    Allow from all 
</Directory> 

Directory populated using SVN checkout: svn checkout file:///var/svn/repo/trunk /var/www/html/b 

的.htaccess:

AddType text/x-component .htc 

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase/

    # Restrict unused HTTP methods 
    RewriteCond %{REQUEST_METHOD} !^(GET|POST|HEAD) 
    RewriteRule .* - [R=405,L] 

    # Forces SSL 
    RewriteCond %{HTTPS} !=on 
    RewriteRule ^.*$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 

    #Removes access to the system folder by users. 
    RewriteCond %{REQUEST_URI} ^_sys.* 
    RewriteRule ^(.*)$ /index.php/$1 [L] 

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

    RewriteRule ^(.*).(pdf|exe|doc|mp4)$ /externaldownload/?fileLocation=$1.$2 [R,L] 
    #Checks to see if the user is attempting to access a valid file, 
    #such as an image or css document, if this isn't true it sends the 
    #request to index.php 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ index.php/$1 [L] 
</IfModule> 

的爲什麼會是這樣的任何想法?

+0

只有一個規則在那裏,你可以分享你的虛擬主機文件,你的'$配置[」 base_url']'設置? – PoX

+0

添加了該信息。 thx的幫助@PoX –

+0

我認爲你有rewritemod/htaccess相關的問題檢查這些或在這裏分享,我們可能會有所幫助。根據服務器名稱,我認爲它的 – PoX

回答

0

我想我理解你的問題在這裏。問題似乎在(:any)您的路線規則。

$route['companyone/(:any)'] = 'sso/ptlatformsso/requestgenericsso/companyone/$1'; 

companyone URL作爲URL的第一段和任何第二部分將被重新映射到sso/ptlatformsso/requestgenericsso/companyone/$1

好像笨傳遞$1作爲變量的函數companyone這意味着你實際上是匹配那裏的任何路線以強制重寫。

如何凝聚這些路由規則,並作出

$route['(.*)'] = "sso/ptlatformsso/requestgenericsso/companyone/$1"; 

或有途徑,如

$route['companyone/(:any)'] = 'sso/ptlatformsso/requestgenericsso/companyone/$1';