简体   繁体   中英

URL Rewrite a Query String

I have Google'ed long for this but can't find an answer.

I have this URL:

www.mysite.com/index.php?tip=1 

(respectively www.mysite.com/?tip=1 )

And want it to rewrite to:

www.mysite.com/tip/1

Your help would be appreciated.

You will need to enable rewrite module in your apache config and put the following settings on the .htaccess file your base folder

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule   ^tip/(.*)  /index.php?tip=$1  [L,NC,QSA]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM