Reputation: 1271
I am new to CI3 and I got really frustated spending more than one week in making the CodeIgniter3 HMVC WireDesignz Routing working with .htaccess and still it is not working properly.
Because there are multiple sources that can cause the error, I write you the link of my GitHub Repository https://github.com/ibudisteanu/PHP-TESTS
The behavior is super easy: I can access the following address with no errors
I get returns for the following links in my routing:
The error I get is Not Found The requested URL /login was not found on this server.
Upvotes: 0
Views: 1374
Reputation: 36
I am using the below code in .htaccess in My HMVC CI3...its working fine on the live Server & on the localhost-
<IfModule mod_rewrite.c>
RewriteEngine On
Options -Indexes
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
Upvotes: 0
Reputation: 560
This is all i did to your htaccess file and its working fine in my test server
Options +FollowSymLinks -Indexes
RewriteEngine on
# NOTICE: If you get a 404 play with combinations of the following commented out lines
#AllowOverride All
#RewriteBase /wherever/ci/is
# RewriteBase /
# Restrict your site to only one domain
# Important USE ONLY ONE OF THESE OPTIONS BELOW!
# Option 1: To rewrite "www.domain.com -> domain.com" uncomment the following lines.
#RewriteCond %{HTTPS} !=on
#RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
#RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
# Option 2: To rewrite "domain.com -> www.domain.com" uncomment the 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 from 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 its a 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 with php5-cgi first
<IfModule mod_fcgid.c>
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
</IfModule>
<IfModule !mod_fcgid.c>
# for normal Apache installations
<IfModule mod_php5.c>
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
</IfModule>
# for Apache FCGI installations
<IfModule !mod_php5.c>
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
</IfModule>
</IfModule>
I just commented RewriteBase /
I dont undestand what RewriteBase does so I may be wrong in my answer.
This is the .htaccess I use with HMVC and I 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]
Upvotes: 1