Remove index.php from URL in Codeigniter

I did it a lot of time. But with what I am stuck here again (on another server) and cannot understand what the problem is.

Editing htaccess completed

<IfModule mod_rewrite.c> RewriteEngine On RewriteBase /glt.me/CI/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /glt.me/CI/index.php/$1 [L] </IfModule> <IfModule !mod_rewrite.c> ErrorDocument 404 /index.php </IfModule> 
  • rewriting module included (as described in customer service)
  • Mistake:

    Internal Server Error

    The server detected an internal error or incorrect configuration and was unable to fulfill your request.

    Contact the server administrator cgiadmin@yourhostingaccount.com and inform them of the time the error occurred and what you might have done that might have caused the error.

    Additional information about this error may be available in the server error log.

    In addition, when trying to use ErrorDocument to process a request, a 500 Internal Server Error was detected.

Check out this case:

 http://glt.me/CI/test http://glt.me/CI/index.php/test 
+7
codeigniter mod-rewrite
source share
7 answers

This is an easy way and it is great for removing index.php from your URL

 RewriteEngine on RewriteCond $1 !^(index\.php|uploads|css|js|lib|img|bootstrap|robots\.txt) RewriteRule ^(.*)$ /manage/index.php/$1 [L] instead of manage put your own application folder name. 
+6
source share

Use the following htaccess code to remove index.php from codeigniter url

 RewriteEngine on RewriteCond $1 !^(index\.php|images|robots\.txt|css) RewriteRule ^(.*)$ ./index.php/$1 [L] 
+2
source share

Although your client has confirmed that the rewriting module works, that you do not confirm it yourself, make a php file in the root of the project using the code below and try to view the file.

 <?php if( !function_exists('apache_get_modules')){ echo 'Rewrite module not available'; }else{ if(in_array('mod_rewrite',apache_get_modules())) echo 'Rewrite module enabled'; } 
+2
source share

First check if apache supports mod_rewrite . If so, add the .htaccess file. My codeigniter.htaccess file:

 DirectoryIndex index.php RewriteEngine on RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ ./index.php/$1 [L,QSA] 

Finally, in your configuration file, change base_url, remove index.php from this if you added.

+1
source share
 DirectoryIndex index.php RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ ./index.php/$1 [L,QSA] RewriteRule ^pages/.*$ http://localhost/test/? [R=301,L] 
0
source share

I wanted to contribute, because I had problems with myself. I use only IIS5.1 for development (not recommended!)

1- Make sure the config.php file has:

 $config['index_page'] = ''; 

2- My application is not in the root folder, it is in localhost / CodeIgniter /. I updated config.php for:

 $config['base_url'] = 'http://localhost/CodeIgniter/'; 

3- You need Mod-Rewrite features. This is built into most servers, but IIS5.1 requires a separate tool. I used: IIS Mod-Rewrite by micronovae. It is free if you use it on localhost

I put the following code (instead of CodeIgniter, put the folder name):

 RewriteEngine on RewriteCond $0 !^/CodeIgniter/(css|js|swf|images|system|tools|themes|index\.php) [NC] RewriteRule ^/CodeIgniter/(.*)$ /CodeIgniter/index.php/$1 [L] 

If your application is at the root, the code you should use will be simple:

 RewriteEngine on RewriteCond $0 !^(css|js|swf|images|system|tools|themes|index\.php) [NC] RewriteRule ^(.*)$ index.php/$1 [L] 

Hope this helps.

0
source share

To remove index.php from only three steps from the url in Codeigniter in the WAMP environment.

1) Create the .htacess file parallel to the application holder and simply copy the following code:

 RewriteEngine On RewriteBase /CodeIgniter/ RewriteCond %{REQUEST_URI} ^system.* RewriteRule ^(.*)$ /index.php/$1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] 

2) Change $ config ['index_page'] to blank in config.php in the application folder, as shown below:

 $config['index_page'] = ''; 

3) Enable "rewrite_module" for apache.

Restart your apache and its execution.

Details: http://sforsuresh.in/removing-index-php-from-url-of-codeigniter-in-wamp/

0
source share

All Articles