PHPGurukul

How to make SEO friendly url using htaccess

what is .htaccess . In this tutorial I will explain how to make SEO friendly url using htaccess. Ex 1 : https://phpgurukul.com/books.php?bookName=php  using  htaccess  url will be written like this https://phpgurukul.com/php You can do this using code given below in htaccess file :

RewriteEngine On
RewriteRule ^([^/\.]+)/?$ books.php?bookName=$1
Ex 2 : https://phpgurukul.com/books.php?bookName=php&&chapter=array   using  htaccess  url will be written like https://phpgurukul.com/php/array You can get by using code in htaccess file given below :
RewriteEngine On
RewriteRule ^([^/\.]+)/([^/\.]+)?$ books.php?bookName=$1&chapter=$2
Ex 3 : https://phpgurukul.com/books.php?bookName=2&&chapter=5 using  htaccess  url will be written like https://phpgurukul.com/php/2/array/5 You can get by using code in htaccess file given below :
RewriteEngine on
RewriteRule product/catName/(.*)/bookName/(.*)/books.php?bookName=$1&chapter=$2
we can handle this url in other way like this https://phpgurukul.com/books-php-2-array-5.html
RewriteEngine on
RewriteRule product-catName-(.*)-bookName-(.*)\.html$ books.php?bookName=$1&chapter=$2
 ]]>

Anuj Kumar

This is Anuj Kumar. I’m a professional web developer with 4+ year experience. I write blogs in my free time. I love to learn new technologies and share with others.
I founded PHPGurukul in September 2015. The main aim of this website to provide PHP, Jquery, MySQL, PHP Oops and other web development tutorials.
.

Recommended Tutorials for you


Add comment

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

Follow us

Don't be shy, get in touch. We love meeting interesting people and making new friends.