mod_rewrite help

New to mod_rewrite? This is a good place to start.

mod_rewrite help

Postby stack » Sat Oct 03, 2009 9:06 am

Hi All
I need make this redirection

http://xxx.domain.com/?id=1234 redirect to

http://yyy.domain.com/yyy?id=1234

(notice: only id= is a variable, and it receives only numbers 0-9)

i have problem with the variable part
how i accomplish that
thanks
stack
 
Posts: 1
Joined: Sat Oct 03, 2009 8:56 am

Postby richardk » Sat Oct 03, 2009 10:47 am

Query string variables are matched with the %{QUERY_STRING} variable and RewriteConds.

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{QUERY_STRING} ^(.*&)?id=[0-9]+(&.*)?$ [NC]
RewriteRule ^$ /yyy [R=301,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 34 guests

cron