How to create seo friendly url in php

Saturday 14th, Jan, 2017 | #SEO #PHP

Today I will talk about another key resource to optimize within our site to have a page with possibilities to fight on the search results pages for a keyword. They are URLs, and their importance is vital to SEO, to define the structure of the site and to improve the way in which the user views the web page. The amount of possibilities around the internal URLs of our site is infinite, and in this article I will give a guide on how to generate friendly URLs

What gives us a friendly URL? A friendly URL or Friendly URL gives us numerous advantages on our website:     

  • By having keywords, the search engine can interpret their content.     
  • When you link without alternative text to the URL - a common practice - the link text contains keywords for which we will be positioned in search engines.     
  • They are recordable by humans, and interpreted by people before accessing the web.     
  • They allow us to hierarchize the pages of the site and organize them into categories better than using PHP files to use.     
  • They hide how the web page is programmed, what parameters it receives, and so on: the user never sees the address of the file being uploaded.     
  • As a matter of aesthetics, the links are more attractive to copy, read, publish them in advertisements ... The web looks cleaner and more professional.

For example this url blog.php?id=1981 You can make user friendly url in php as: blog/title-of-my-post-1981

you want a mod_rewrite (placed in an .htaccess file) rule that looks something like this:

RewriteEngine on
RewriteRule ^blog/([^/]*)$ /blog.php?id=$1

Now Get id (1981) from PHP

$UID = substr($url, strrpos($url, '-') + 1);
echo $UID;

Contrats.....Now you have a friendly url in php