routes - CodeIgniter3 HMVC Routing with .htaccess not working -
i new ci3 , got frustated spending more 1 week in making codeigniter3 hmvc wiredesignz routing working .htaccess , still not working properly.
because there multiple sources can cause error, write link of github repository https://github.com/ibudisteanu/php-tests
the behavior super easy: can access following address no errors
i returns following links in routing:
the error not found requested url /login not found on server.
this did htaccess file , working fine in test server
options +followsymlinks -indexes rewriteengine on # notice: if 404 play combinations of following commented out lines #allowoverride #rewritebase /wherever/ci/is
# rewritebase /
# restrict site 1 domain # important use 1 of these options below! # option 1: rewrite "www.domain.com -> domain.com" uncomment following lines. #rewritecond %{https} !=on #rewritecond %{http_host} ^www\.(.+)$ [nc] #rewriterule ^(.*)$ http://%1/$1 [r=301,l] # option 2: rewrite "domain.com -> www.domain.com" uncomment following lines. #rewritecond %{https} !=on #rewritecond %{http_host} !^www\..+$ [nc] #rewritecond %{http_host} (.+)$ [nc] #rewriterule ^(.*)$ http://www.%1/$1 [r=301,l] # option 3: remove index.php url #rewritecond %{http:x-requested-with} !^xmlhttprequest$ #rewritecond %{the_request} ^[^/]*/index\.php [nc] #rewriterule ^index\.php(.*)$ $1 [r=301,ns,l] # send request via index.php (again, not if real file or folder) rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d #rewritecond $1 !^(index\.php|public_html|\.txt|robots\.txt|favicon\.ico|style\.css) # deal php5-cgi first <ifmodule mod_fcgid.c> rewriterule ^(.*)$ index.php?/$1 [qsa,l] </ifmodule> <ifmodule !mod_fcgid.c> # normal apache installations <ifmodule mod_php5.c> rewriterule ^(.*)$ index.php/$1 [qsa,l] </ifmodule> # apache fcgi installations <ifmodule !mod_php5.c> rewriterule ^(.*)$ index.php?/$1 [qsa,l] </ifmodule> </ifmodule>
i commented rewritebase /
i dont undestand rewritebase may wrong in answer.
this .htaccess use hmvc , have no problems.
rewriteengine on options -indexes rewritecond $1 !^(index\.php|assets|robots\.txt) rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php/$1 [l,qsa]