How to convert dynamic URL to static URL

in order to convert dynamic url to static url, you'll need mod_rewrite module and .htaccess file if your website is hosted in apache server.

Sample Dynamic URL: http://yourdomain.com/product.php?categoryid=1&productid=10

Single Page URL
Generated URL: http://yourdomain.com/product-categoryid-1-productid-10.htm
.htaccess code:
Options +FollowSymLinks
RewriteEngine on
RewriteRule product-categoryid-(.*)-productid-(.*)\.htm$ product.php?categoryid=$1&productid=$2

Directory Type URL
Generated URL: http://yourdomain.com/product/categoryid/1/productid/10/
.htaccess code:
Options +FollowSymLinks
RewriteEngine on
RewriteRule product/categoryid/(.*)/productid/(.*) product.php?categoryid=$1&productid=$2
RewriteRule product/categoryid/(.*)/productid/(.*)/ product.php?categoryid=$1&productid=$2

Was this answer helpful?

Also Read

What are error pages?

Error pages are the pages displayed when a user tries to access a location on your site and...

How to redirect user from none www to www.domain?

Scenario: You want to force all users/client to access your website using https instead of http....

Failed to upload image or file to wordpress

Issue:There will be possibilities where you will not be able to upload any images or files to...

How to solve PHP issue with " ini_set() has been disabled for security reasons"?

Issue: You may facing error saying that "ini_set() has been disabled for security reasons". You...

How to redirect user from http to https?

Scenario: You want to force all users/client to access your website using https instead of http....