.htaccess - hide php get variables [closed]

2019-09-21 23:55发布

问题:

I have a webpage that I would like to rewrite the URL to. However, after about 1 hour of searching on Google and here, I couldn't find anything that made since to me, therefore, wouldn't work.

Current Website: www.example.com/page1/page2?var=1

I want that changed to www.example.com/page1/page2/1

Any help will be appreciated!

Thanks,

ZG

回答1:

Do you always have two components in the URI? If so, create an .htaccess file like this:

RewriteModule On
RewriteRule ^(.*)/(.*)/(.*)$ /$1/$2?var=$3