How to remove index.php from url?

remove index.php from url


Hello to all, welcome to In this post, I will tell you How to remove index.php from url? and you need to add this code into your .htaccess file.

Here is the working code and you need to add this .htaccess file:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

There are so many codes in htaccess and I will let you know all. Please do comment if you any query related to this post. Thank you.

Ajay Malhotra
the authorAjay Malhotra
Hello to all. Welcome to Myself Ajay Malhotra and I am full stack developer. I love coding. I know Wordpress, Core php, Angularjs, Angular 2, Angular 6, Angular 7, laravel, Codeigniter, Shopify, Squarespace, Jquery, Google Map Api, Vuejs, Reactjs, Bigcommerce etc.


  • update query in laravel:
    with pdo:
    public function update(Request $request)
    parse_str($request->formdata, $data);
    $client_id = \Hashids::decode($request->client_id);
    $data[‘birthday’] = date(‘Y-m-d’, strtotime($data[‘birthday’]));
    // return response()->json([
    // ‘firstname’ => $data[‘firstname’]
    // ]);
    $QUERY = $this->PDO->prepare(“UPDATE user SET firstname = :firstname,
    lastName = :lastName,
    dob = :dob,
    email = :email,
    phone = :phone,
    client_notes = :client_notes WHERE objectId = :objectId”);
    $QUERY->bindParam(“firstname”, $data[‘firstname’],\PDO::PARAM_STR);
    $QUERY->bindParam(“lastName”, $data[‘lastname’],\PDO::PARAM_STR);
    $QUERY->bindParam(“dob”, $data[‘birthday’],\PDO::PARAM_STR);
    $QUERY->bindParam(“email”, $data[’email’],\PDO::PARAM_STR);
    $QUERY->bindParam(“phone”, $data[‘phone’],\PDO::PARAM_STR);
    $QUERY->bindParam(“client_notes”, $data[‘clientnote’],\PDO::PARAM_STR);
    $QUERY->bindParam(“objectId”, $client_id[0],\PDO::PARAM_STR);

    return response()->json([
    ‘client_id’ => $client_id[0],
    ‘message’ => ‘success’

    basic laravel:

    public function updateUserDetails(Request $request, $id)
    $this->validate($request, [
    ‘first_name’ => ‘required|min:2’,
    ‘last_name’ => ‘required|min:2′,
    ’email’ => ‘required|email|unique:users,id,’.$id,
    ‘phone_no’ => ‘required’,
    ‘birthday’ => ‘required|date’,
    ‘roles’=> ‘required’
    $user = Sentinel::findById($id);
    $updates = [
    ‘first_name’ => $request->first_name,
    ‘last_name’ => $request->last_name,
    ’email’ => $request->email,
    ‘phone_no’ => $request->phone_no,
    ‘birthday’ => $request->birthday
    $user = Sentinel::update($user, $updates);
    return redirect(‘/super/users’);

    jQuery(“#tab11 .col-lg-3.col-md-3.col-sm-12.nopadding a”).each(function() {

    var textlimit = jQuery(this).text().replace(/^(.{20}[^\s]*).*/, “$1”) + “…”;
    //var textlimit = jQuery(this).text().substring(0, 65) + “…”;
    textlimit = textlimit.replace(“(more…)”, “”);


    jQuery(‘body’).keypress(function(e) {
    if (e.keyCode == 27) { // escape key maps to keycode `27`
    jQuery(“.page-template-contact-us-template .buttons-div”).show(200);
    jQuery(“body”).css(“overflow-x”, “”);

    // 2. This code loads the IFrame Player API code asynchronously.

    // 3. This function creates an (and YouTube player)
    // after the API code downloads.
    var player;

    function onPlayerReady(event) {


    // 5. The API calls this function when the player’s state changes.
    // The function indicates that when playing a video (state=1),
    // the player should play for six seconds and then stop.

    var done = false;

    function onPlayerStateChange(event) {
    if ( == YT.PlayerState.PLAYING && !done) {
    setTimeout(stopVideo, 38000);
    done = true;

    function stopVideo() {

    function onYouTubePlayerAPIReady() {

    player = new YT.Player(‘player’, {
    height: ‘360’,
    width: ‘640’,
    videoId: ‘IJ4BFjOMnpg’,
    events: {
    ‘onReady’: onPlayerReady,
    ‘onStateChange’: onPlayerStateChange

    $(‘#notify [value=selectvalname]’).attr(‘selected’,’selected’);
    $(“input[name=gender][value=name]”).attr(‘checked’, ‘checked’);

  • private function custom_date_diff($previous_date){

    $fdate = $previous_date;
    $tdate = Carbon::now()->toDateTimeString();
    $datetime1 = new \DateTime($fdate);
    $datetime2 = new \DateTime($tdate);
    $interval = $datetime1->diff($datetime2);
    $hours = $interval->h;//now do whatever you like with $hours
    $days = $interval->format(‘%a’);//now do whatever you like with $days
    return $hours;


    ==use in view===
    $datetime1 = new \DateTime($fdate);
    $datetime2 = new \DateTime($tdate);
    $interval = $datetime1->diff($datetime2);
    echo $hours = $interval->h;//now do whatever you like with $hours
    //echo $days = $interval->format(‘%a’);//now do whatever you like with $days

  • Am yet to try this option, i have had quiet alot of trouble working with .htaccess in my previous web site, where turning it on messes with my everything and pages fail to load correctly.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Positive SSL