Check How to make SEO friendly url using htaccess from Coding section on e akhabaar
In previous tutorial we learned about 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
Post your more queries related to How to make SEO friendly url using htaccess below.