Ben CodeIgniter 1.7.2 ve HMVC (https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/wiki/Home) kullanıyorum.
Ben bu dosyaları var ve onlar HMVC göre düzenlenir:
system/application/modules/welcome/controllers/welcome.php
system/application/modules/welcome/views/index.php
In routes.php
, ben bir rota kurdunuz:
routes['welcome']='welcome/index';
Everything works if the url is in this pattern:
http://www.mydomain.com/index.php/welcome
Ama şimdi ben url index.php kaldırmak istiyorum, bu yüzden htaccess dosyası oluşturdu.:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?$1 [L]
Sonra $config['index_page']
boşaltmak için ayarlayın:
$config['index_page'] = "";
Now I can access the page in this url pattern:
http://www.mydomain.com/welcome
Her şey iş gibi görünüyor olsa da, ben sayfaya erişmek her zaman, o günlüğüne bir 404 sayfa bulunamadı hatası oluşturur bulabilirsiniz:
DEBUG - 2011-01-02 08:28:52 --> URI Class Initialized
ERROR - 2011-01-02 08:28:52 --> 404 Page Not Found -->
This is not specific to the welcome
page, all pages are having the same problem.
I digged into the codes and discovered that this 404 Page Not Found
message is generated from the MX_Router.php
that comes with HMVC. Specifically, it's from this function:
public function _validate_request($segments) {
/* locate module controller */
if ($located = $this->locate($segments)) return $located;
/* use a default 404 controller */
if (isset($this->routes['404']) AND $segments = explode('/', $this->routes['404'])) {
if ($located = $this->locate($segments)) return $located;
}
/* use a default 404_override controller CI 2.0 */
if (isset($this->routes['404_override']) AND $segments = explode('/', $this->routes['404_override'])) {
if ($located = $this->locate($segments)) return $located;
}
/* no controller found */
show_404();
}
Bu çağrılır ve bu nedenle ben bu hata mesajı alıyorum show_404 () fonksiyonu bulunuyor. Ben var url desen kullanarak herhangi bir sorun olmadan her sayfayı erişebilirsiniz beri Ama index.php
kaldırıldı.
Why is HMVC thinking there's no controller found in this _validate_request()
function?
I will not get the 404 error message in the log if I revert the changes but this also means that I have to keep using the url pattern that has index.php
, which looks pretty bad.
Anyone has encountered the same problem before? Many many thanks to you all.