xx7xx7xx
xx7xx7xx

Reputation: 113

mod_rewrite from URL to GET variable

If someone tries to access this page:

www.myhomepage.com/m/40921

I want the URL (above) to remain the same but the content should be from this page:

www.myhomepage.com/msg?t=40921

Upvotes: 0

Views: 31

Answers (1)

Henrique Arthur
Henrique Arthur

Reputation: 1058

If it must be exactly like you said, then use this

RewriteRule ^m/([0-9]+)\/?$ msg?t=$1

But I think you made a typing error. Shouldn't it be msg.php? If so, use this:

RewriteRule ^m/([0-9]+)\/?$ msg.php?t=$1

And in your php file, you can get the t with $_GET['t'].

Upvotes: 1

Related Questions