rewrite get parameters in .htaccess

2019-09-20 06:56发布

问题:

Here is my website : http://www.example.com and i want to rewrite url in .htaccess here is URL : http://www.example.com/sub_portfolio.php?act=sub_cat and i want to ..

/sub_portfolio/sub_cat

i tried many rewrite condition it not worked and also check many post in our website stack overflow. like url rewrite conditions

give suggetion...

回答1:

You can easily rewrite your url using the following code.

RewriteEngine On
RewriteRule ^sub_portfolio/([A-Za-z0-9-]+)/?$ sub_cat.php?act=$1 [NC,L]

Make sure you place this code in your .htaccess file which should located in the same folder

Hope that helps