Core PHP Creating SEO Friendly URL using htaccess

Core PHP Creating SEO Friendly URL using htaccess

In this Post We Will Explain About is Core PHP Creating SEO Friendly URL using htaccess With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to SEO Friendly URLs with PHP Example

In this post we will show you Best way to implement Generate SEO Friendly URL from String in PHP, hear for How to make a seo friendly url using php and .htaccess with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

SEO – URL using php code and .htaccess

In this post We would like to Learn about the simple url generate seo friendly urls using simple php source code as well as .htaceess. The following some PHP function for seo friendly urls simple way to generation with the simple or best way php source code

PHP Source Code


function cleanURL($string)
{
	
	$live_url = str_replace("'", '', $string);
	$live_url = str_replace("%20", "", $live_url);
	$live_url = preg_replace('~[^\\pL0-9_]+~u', '-', $live_url); 
	//devloped by Pakainfo.com it is for live_url substitutes anything but some letters and then some numbers as well as some ‘_’ with separator
	$live_url = trim($live_url, "-");
	$live_url = iconv("utf-8", "us-ascii//TRANSLIT", $live_url);  
	//devloped by Pakainfo.com We can optimize for our own some custom character map for data encoding.
	$live_url = strtolower($live_url);
	$live_url = preg_replace('~[^-a-z0-9_]+~', '', $live_url); 
	//devloped by Pakainfo.com It is for keep only some letters as well as some  numbers, ‘_’ and more separator
	return $live_url;
	}
	 echo cleanURL("krunal's%20Blog%20For%20(PHP)");  
	// krunal-Blog-for-PHP
?>

If we want to simple redirect the my url file like as a

domain.com/ live-products.php?pid=1and then that is simple way to direct
domain.com/live-items-1

for that simple root path to place the .htaccess file at the your root www domain main folder

.htacess file source code


ForceType application/x-httpd-php

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^[^-]+-[^-]+-[^-]+-([0-9]+)$ live-products.php?pid=$1 [L]
RewriteRule ^[^-]+-[^-]+-([0-9]+)$ live-products.php?pid=$1 [L]
RewriteRule ^[^-]+-([0-9]+)$ live-products.php?pid=$1 [L]

You are Most welcome in my youtube Channel Please shubscibe my channel. and give me FeadBackMore Details……
Angularjs Example

Example

I hope you have Got What is Generate SEO Friendly URL from String in PHP And how it works.I would Like to have FeadBack From My Blog(Pakainfo.com) readers.Your Valuable FeadBack,Any Question,or any Comments about This Article(Pakainfo.com) Are Most Always Welcome.

Leave a Comment