0
,所以我有笨的內部多笨象這樣:笨裏面笨國防部重寫問題
- application
- controllers
- models
- views
- system
- index.php
- .htaccess
- foo
- application
- controllers
- models
- views
- system
- index.php
- .htaccess
- bar
- application
- controllers
- models
- views
- system
- index.php
- .htaccess
一切都已經完美運行。我可以訪問所有的控制器和子目錄。
- www.myweb.com/controller_name/qwe
- www.myweb.com/foo/controller_name/qwerty
- www.myweb.com/bar/controller_name/qwer
當我感動了所有的代碼到另一臺服務器(具有相同的配置&指着新的服務器,我遇到了問題。
- subdomain.myweb.com/controller_name/qwe (working)
- subdomain.myweb.com/foo/controller_name/qwerty (error not found)
- subdomain.myweb.com/foo/index.php/controller_name/qwerty (working)
- subdomain.myweb.com/bar/controller_name/qwer (working)
我懷疑問題出在內部的.htaccess文件。但我就是不明白,哪一個是造成問題的原因。
.htaccess from the root:
====================================================
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
#Checks to see if the user is attempting to access a valid file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
#Remove the index.php
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
.htaccess from subdir foo:
====================================================
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /foo/
#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]
#Remove the index.php
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
.htaccess from subdir bar:
====================================================
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /bar/
#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]
#Remove the index.php
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
有人能告訴我怎樣才能解決這個問題。這樣我可以訪問SUBD omain.myweb.com/foo/controller_name/qwerty正確無需使用index.php?