Home Php How to remove index.php from url?

How to remove index.php from url?

by therichpost
6 comments

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

You may also like

6 comments

Jeffreyviede March 3, 2018 - 7:53 am

good post…working well

Reply
therichpost March 3, 2018 - 8:43 am

Thank you

Reply
alexa March 6, 2018 - 11:52 am

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

Reply
alexa June 2, 2018 - 7:13 am

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
?>

Reply
Newtoxton Klean Anthony November 27, 2018 - 11:39 am

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.

Reply
Ajay Malhotra November 27, 2018 - 3:34 pm

Hi Newtoxtox, are you doing this in core php? Show me your page error and coding. I will help you.
Thank you.

Reply

Leave a Comment

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