Reputation: 167
I am working on codeigniter 3.1.6.
I added the .htaccess file.
I also changed the base_url
path to my project path, removed the index.php
from index_page
and changed the url_protocol
to REQUEST_URI
.
Still, while I am redirecting the url to any controllers method it throwing an error as 'The page you requested was not found
.'
I also searched and applied different .htaccess but its not working.
If I am addling /index.php
at end of base_url then its working but its wrong though. It should work without index.php.Only 3.1.6 giving this issue.
note: codeigniter-3.1.4 is working properly only this version is giving an issue
Upvotes: 4
Views: 10583
Reputation: 1
Additional tip: make sure .htacces in the root folder not inside >application folder
Upvotes: 0
Reputation: 1
1:Create .htaccess file in root directory not another project folder directory.
2:write or copy this code and paste it
`<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
<IfModule>`
I hope this will work properly. Go In Config file and make changed $config['url_protocol']='auto';
Upvotes: 0
Reputation: 303
Use this script in .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
# !IMPORTANT! Set your RewriteBase here and don't forget trailing and leading
# slashes.
# If your page resides at
# http://www.example.com/mypage/test1
# then use
# RewriteBase /mypage/test1/
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|robots\.txt|css|docs|js|system)
RewriteRule ^(.*)$ index.php?/$1 [L]
# If your root folder is at /mypage/test1/
RewriteRule ^(.*?)$ /mypage/test1/index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
</IfModule>
Remove index.php
from config.php
$config['index_page'] = '';
Upvotes: 2
Reputation: 1521
Change folder name CodeIgniter-3.1.6
to ci
Set your base_url
to
$config['base_url'] = 'http://localhost/ci/
Use this .htaccess
RewriteEngine On
RewriteBase /ci
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
Upvotes: 3
Reputation: 24
1) Edit config.php
$config['index_page'] = 'index.php';
To
$config['index_page'] = '’;
2) Create/Edit .htaccess file
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Upvotes: 1