i try to do 301 redirect from this address:
/web/8888/nsf/sbs.py?&_ID=9884&did=3025&PF=14&G=9884&SM=9884&lang=HE&_UserReference=956357C53FD2C8024C72开发者_如何学Go5EE5
to this address:
/?page=product&p_id=9884
the 9884 value is dynamic value the others always not
I try to use:
Redirect 301 "/web/8888/nsf/sbs.py?&_ID=9884&did=3025&PF=14&G=9884&SM=9884&lang=HE&_UserReference=956357C53FD2C8024C725EE5" /?page=product&p_id=9884
someone can help me solve that issue?
The problem is that Redirect
does not examine query strings when performing a match. Instead, you'll need to use mod_rewrite
to perform your redirections.
Keeping that in mind, from your example URL, it sounds like you want something like this:
RewriteEngine On
# Check if the path part matches the URLs we want to redirect
# If so, check if the query string contains an ID
# If we find an ID, redirect to the correct product page with that ID number
RewriteCond %{QUERY_STRING} (\A|&)_ID=([0-9]+)
RewriteRule ^web/8888/nsf/sbs\.py$ /?page=product&p_id=%2 [R=301,L]
精彩评论