CodeIgniter Remove index.php By .htaccess

In this tutorial I am going to show how to remove index.php from URL using .htaccess file in CodeIgniter. htaccess is the shortened used for Hypertext Access, which is a powerful configuration file that controls the directory “.htaccess”. It is used by Apache based web servers to control various server features.
Now The Question Arises Why Exactly do we want to remove index.php..?? As CodeIgniter’s URLs are designed to be search engine friendly and to human too. And so to maintain the standards we need to remove the default index.php which appears in the url of codeigniter applications, so that the url becomes search engine friendly and looks clean.
The script contains the code with proper documentation to perform the following transformation.


Steps To Remove index.php using .htaccess:-

Step:-1  Open the file config.php located in application/config path.  Find and Replace the below code in config.php  file.
//  Find the below code

$config['index_page'] = "index.php"

//  Remove index.php

$config['index_page'] = ""
Step:-2  Go to your CodeIgniter folder and create .htaccess  file.

Path:
Your_website_folder/
application/
assets/
system/
user_guide/
.htaccess <--------- this file
index.php
license.txt
Step:-3  Write below code in .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
Step:-4  In some cases the default setting for uri_protocol does not work properly. To solve this issue just open the file config.php located in application/configand then find and replace the code as:
//  Find the below code

$config['uri_protocol'] = "AUTO"

//  Replace it as

$config['uri_protocol'] = "REQUEST_URI" 

Conclusion:

Hope these steps helped you to remove index.php in CodeIgniter framework using .htaccess. Keep reading our blogs. 

Export and Import an Individual MySQL Table from command line

While moving databases from development to production and vice versa it is sometimes necessary to export individual tables so that they can be imported into another database.

So in this post i will show you how to export and import individual MySQL Table

Export a single MySQL table


mysqldump -u username root -p dbname tablename > d:\tablename.sql


Import a previously dumped MySQL table



mysql -u username -p PASSWORD_HERE -D dbname < d:\dump.sql


That’s it.

How to turn off MySQL strict mode?

Follow the below mentioned instructions to turn off or to disable the MySQL strict mode. This can be fixed in one of two ways

Method 1. 

Make the following changes in the “my.ini/my.cnf”:

1. Look for the following line , this line will set MySQL strict mode
sql-mode =  "STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

2. To disable MySQL strict mode, you can change the above line as follow:
sql_mode="TRADITIONAL,NO_AUTO_CREATE_USER,,NO_ENGINE_SUBSTITUTION"

3. Restart the MySQL service.

Method 2 :
You may be able to run an SQL query within your database management tool such as phpMyAdmin which can normally be found from your web hosting control panel:

SET @@global.sql_mode= '';

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.