本地的httpd.conf檔案的LoadModule rewrite_module modules/mod_rewrite.so已經開啟
根目錄下的.htaccess檔案重寫規則如下:
<IfModule mod_rewrite.c>
#Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>
config.php檔案中已經設定:'URL_MODEL' => 2,
#發佈到伺服器上訪問:http://網域/admin可以正確訪問,但是在本地測試環境,將應用根目錄虛擬網域後訪問:
http://inurse.com/admin報錯:
404 NOT Found
The requested URL /Admin/Org/orgAdd was not found on this server.
想請問這是為什麼呢? Apache重寫路由規則的原理是什麼(簡單易懂的解釋)?
另:重寫規則已經嘗試過:RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
RewriteRule ^( .*)$ index.php?s=/$1 [QSA,PT,L]
樓主,你的配置好像有誤:
1、下面的配置應該是 apache 的設定 httpd.conf
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
2、.htaccess 設定只需要中間的:RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-f
建議用第二種方式;RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]