How to remove index.php from Codeigniter url

Here we will learn how to remove index.php from codeigniter url.

Each of codeigniter constructed url contains the value index.php and excluding root url. No url cannot be run without index.php

Assume a scenario , we have a website named www.myciportal.com

Where we didn’t remove the index.php from url and i have a category with following details

category name: techbuzz

So by default it’s url will create like  following

default url : www.myciportal.com/index.php/techbuzz

it will not run like this way

www.myciportal.com/techbuzz

For make this possible we have to work on config and htaccess both and steps are following to achieve this task

If you are using mod_rewrite to remove the index.php in each url construct of codeigniter then you have to follow these steps:
Step 1: In CI Project root Folder of your project create a .HTACCESS file and place following code in it

Comments :: In above code myprojectname is passed with RewriteBase , which is the demo project name of our ci project,if you are running on main domain then Redirect base will be / only , or if you are running your project in any directory then you have to specify that name.
Now Step 2:
in your project >> application/config/config.php
Replace following line

with

Now you can run your Codeigniter project and you can see the index.php has been removed from every Controller Action

How to Make First PHP Program?

Hi Friends,

Before writing first PHP Program, you will have to set the environment. And, for make this, you need to install the Xampp server in your system.

After successful installation, we need a code editor, there are several code editors like Notepad++, Code Lobster, Netbeans etc. You can use any code editor as per your comfort for writing code.

First off, go to the drive where you have installed the Xampp server. Click on Xampp and go to the htdocs folder. But don’t forget to start Xampp control panel and Apache, MySql services before writing the code. Now create a folder for your project with any name. Suppose we create a folder name myproject.

Now inside this folder create a file name index.php. Below is the snippet for creating your first PHP program:

Program for Print Hello W3school

echo is a php function used for print/display on web browsers.

Now Run in localhost by following address

http://localhost/myproject/index.php

This will print the output as follows

 

Now we have done with “how to make first PHP program,” we will learn about the if – else statements, switch cases, array, data retrieval from database and many more, which are important to create a complete website.

How to Install Xampp Server?

XAMPP  is a free  web server package developed by Apache Friends. It consists interpreters for code written in PHP programming language, and it has few other elements also which are as follows:

  1. Apache: It’s an application server which must be installed in machine to run a PHP program.
  2. Mysql:  A database system for data storage in tables.
  3. PHP: A server side scripting language, widely used for dynamic website creation.

Now follow the link to download and install Xampp server according to your operating systems whether it is Windows, Linux or Unix.

Download Xampp from it’s Official Website click here

After downloading the setup file you can access the url by http://localhost/

Create any program or Project you can see in this article

PHP Tutorial for Beginners – An Introduction

PHP (PHP Hypertext Preprocessor) is a web development scripting language which is widely used for creating dynamic websites and portals.

It Supports oops (object oriented programming standards). Top 5 frameworks which are very popular these days in web development are written in php, which are as follows:

  • Laravel (Completely written in Symphony Objects)
  • Symphony (Very Powerful Framework)
  • CodeIgniter
  • Zend (acquired PHP itself)
  • Cake PHP

All of these frameworks follow MVC (Model,View,Controller) architecture. It also has several cms also. We are providing a brief overview here:

WordPress: It is basically built for blogging websites, but now you can make any informative web portals and using its woo-commerce extension, you can make e-commerce website also.
Joomla: Web Portal development can be used for Ecommerce and News Portal and Great CMS.
Drupal: Drupal is also most popular and advance level cms and can be used possibly for every type of web portals, including blog, magazine, newspaper, e-commerce. This can be used for any other complex cms also.

Like these cms, few shopping cart solutions are also popular in this competitive market. They are listed below
Magento: We can say it an e-commerce king as it is widely used for enterprise level e-commerce websites.
Opencart: A very lightweight cart solution and it is ready to use for medium level e-commerce projects
Prestashop: it is also very useful shopping cart solution, widely used in the United Kingdom for creating shopping websites and portals.

So, my dear friends, you have experienced our first PHP TUTORIAL. We will keep you update with our further web development tutorial series also.