Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I realise there are similar questions but I'm trying to work out how I can rewrite the following URL:

http://www.myWEBaddress.com/?month=200904

to

http://www.myWEBaddress.com/my-page.php?month=200904 

Regards

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
153 views
Welcome To Ask or Share your Answers For Others

1 Answer

Add the following to the .htaccess file in the root directory of your site.

RewriteEngine on
RewriteBase /

RewriteCond %{QUERY_STRING} (^|&)month= [NC] 
RewriteRule ^ my-page.php [L]

If you want to change the URL that the user sees in their browser address bar, change the last rule to

RewriteRule ^ my-page.php [L,R=301]

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...