PHP - How to get pretty or clean urls/links using HTACCESS - Full Tutorial[Part 2 of 2]

preview_player
Показать описание
Second part of the tutorial on how to get pretty or clean urls for your PHP websites
Рекомендации по теме
Комментарии
Автор

oh man, I wish I discovered you 5 years ago.. Your channel is a Gold!!

envadd.
Автор

Fantastic video! My only issue with this, is that it isn't strictly SEO friendly - as requiring the 404.php file still returns a 2xx response code
This essentially means that Google could index every different variation of the page, regardless of if it exists or not.


To counteract this, use the php header function to fire a 404 response code. This would need to be done at the start of index.php before other headers had been sent.
Code:
<?php
// IF statement should go here checking if the page exists
// IF FILE_EXISTS($file)!==TRUE{
header("HTTP/1.0 404 Not Found");
// Require 404 file
require_once('404.php');
// } else {
// Continue as normal
// }
?>


I hope this helps anyone wondering about SEO :)

AidenMacIver
Автор

I finally used a server variable REDIRECT_QUERY_STRING and select a particular ID from the database
Thank for the tutorial

costakamalabe
Автор

Thats what I needed. Thank You very much.

archeopteryks
Автор

Please how to get the parameters name and age in profile page?

sixmasimango
Автор

cant find the menus on other pages and my index page directs me to Page not found, Please assist.
because i did the same just like you.

pozilharold
Автор

Hey. Thanks for the video. But can I do this with GET supergloblal?

chibututunnamani
Автор

2:33 This is quite clunky and i don't think i can recommend this. You should be able to cut the characters by doing a <base href=""> instead of prepending the base url function for every href attribute.

tankinam
Автор

Could you help me with this..
I did the url rewrite for my website like.. from www.mysite.com/view.php?id=4 to www.mysite.com/view/4
but all the links on header and footer or even inside that page of view/4 are changed to www.mysite.com/view/aboutus when i click on the aboutus page on the header menu
How to fix this please..

LIKE-wyly
Автор

How do I create pretty URLs by post name?

alishalamichhane
Автор

hello sir
after cleaning url bootstrap stops working kindly help

tks
Автор

When testing this on a live server I found that if someone landed on the domain that the 404.php loaded straight away.

DavidAshby
Автор

After applying htaccess
External css file not working...

adityatondon
Автор

singel-post.php?post-id=72 this is my URL it is with a query string Want to remove singel-post.php?=

premkumar-rwjg
visit shbcf.ru