[英]How XAMPP 1.7.3 can support PHP 5.3 and PHP 5.2 and other lower PHP
[英].htacces is not working with CodeIgniter 1.7.3, php 5.3
我試圖用.htaccess,CI 1.7.3和php 5.3隱藏index.php並收到錯誤404。但是在具有php 5.2的開發服務器上工作正常,其余的都是相同的配置,我開發了HMVC和我的.htaccess的應用程序是
RewriteEngine on
Options -Indexes
RewriteBase /myapp/
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5})$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /myapp/index.php?/$1 [L]
有人建議我如何解決此問題,我應該升級我的CI版本嗎?
謝謝
嘗試
RewriteEngine on
Options -Indexes
RewriteBase /myapp/
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5})$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [L]
要么
RewriteEngine on
Options -Indexes
RewriteBase /
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5})$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ myapp/index.php?/$1 [L]
可能是您的.htaccess認為應改為打開myapp/myapp/index.php
。
從system / application / config目錄打開config.php
並更換
$config['index_page'] = “index.php” by $config['index_page'] = “”
在CodeIgniter目錄的根目錄中創建一個“ .htaccess”文件
並添加以下行。
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
在某些情況下,uri_protocol的默認設置無法正常工作。
為了解決這個問題,只需更換
`$config['uri_protocol'] = “AUTO”`
通過
$config['uri_protocol'] = “REQUEST_URI”
從system / application / config / config.php
您是否檢查過服務器中是否包含apache重寫模塊,並且是否在apache配置文件中啟用了重寫規則。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.