Categories

Friday, November 22, 2024
#919814419350 therichposts@gmail.com
Php

How to remove index.php from url?

remove index.php from url

Hello to all, welcome to therichpost.com. 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. Therichpost.com

therichpost
the authortherichpost
Hello to all. Welcome to therichpost.com. Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 19, MedusaJs, Next.js, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

6 Comments

  • 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);

    $QUERY->execute();
    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

    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(this).text(textlimit);

    });

    jQuery(‘body’).keypress(function(e) {
    if (e.keyCode == 27) { // escape key maps to keycode `27`
    jQuery(“.request-form-container”).hide(200);
    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) {
    //event.target.playVideo();

    }

    // 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 (event.data == YT.PlayerState.PLAYING && !done) {
    setTimeout(stopVideo, 38000);
    done = true;
    }
    }

    function stopVideo() {
    player.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===
    toDateTimeString();
    $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.