Rewrite dynamic URL to static URL in PHP using .htaccess

When search engine visits the dynamic url site i.e, so it does not gives the more importance to this page because it keeps on chainging. So we convert the dynamic URL to static URL like:  =>

Example to make URL SEO friendly:

 First of all on the RewriteEngine

RewriteEngine On

Write a rule to Rewrite URL

RewriteRule ^category/([^/]*)/([A-Za-z0-9-]+)/$ category.php?id=$1&title=$2 [L]

This example will make this url ( category.php?id=1&title=2 ) to category/1/this-is-rewrite-url/


^: pattern should match from the beginning of the string

(: start of subpattern

[^/]: write anything

*: one or more times

): end of subpattern

(: start of subpattern

[A-Za-z0-9-]: class of characters

+: one or more times

): end of subpattern

/: foward slash…

?: can occur zero or once

$: end of string

Bansal Sumit

To seek challenging roles and to achieve excellence in the field of Open Source Web Technology with a profound spirit of commitment and dedication.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *