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

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....

How do I configure a cron job?

Login to cPanel. Locate and click on the "Cron Jobs" icon under the "Advanced" category. Fill...

Why is SEO important?

SEO (Search Engine Optimization) enables your website to be more accessible by the search...

Cannot connect to database

This error will occur within a web application when any of the following conditions are met:...

How to change PHP versions using MultiPHP

MultiPHP enables you to use multiple versions of PHP on your server at the same time. Step 1 :...