How to Remove index.php From Codeigniter Website's URL
Here is the step by step process of removing index.php factor from your Codeigniter website or web application.
1. Navigate to your config file through Application=>config=>config.php and change following lines:-
$config['base_url'] = 'http://example.com/';
$config['index_page'] = '';
2. Now create a .htaccess file on root directory of your website or web application.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Removes index.php from ExpressionEngine URLs
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteCond %{REQUEST_URI} !/system/.* [NC]
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]
# Directs all EE web requests through the site index file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ Your Folder Name/index.php/$1 [L]
</IfModule>
Copy above code and paste it in .htaccess file. Now run your web application you got there is clean URL into your Codeigniter web application
Cheers❤
1. Navigate to your config file through Application=>config=>config.php and change following lines:-
$config['base_url'] = 'http://example.com/';
$config['index_page'] = '';
2. Now create a .htaccess file on root directory of your website or web application.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Removes index.php from ExpressionEngine URLs
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteCond %{REQUEST_URI} !/system/.* [NC]
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]
# Directs all EE web requests through the site index file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ Your Folder Name/index.php/$1 [L]
</IfModule>
Copy above code and paste it in .htaccess file. Now run your web application you got there is clean URL into your Codeigniter web application
Cheers❤
Comments
Post a Comment