Redirect nasty multi parameter URL
5 posts
• Page 1 of 1
Redirect nasty multi parameter URL
Hi, I don't even know where to begin a rewrite rule with this one, or if it's even possible. Here's an example:
I'm using a map file now for the simpler redirects, but I'd like to create a separate map file just for these and provide a new static URL to 301 them to. I don't even know what the old parameters are, so I'm going to have to go through them one by one and figure out the context of what people were trying to link to. I only have about 40, so it shouldn't take too long.
Here's one of our current rules:
RewriteMap mapfile txt:mapfile.txt
RewriteCond %{QUERY_STRING} ^product_id=(.+)$
RewriteCond ${mapfile:%1|NOT_FOUND} !NOT_FOUND
RewriteRule ^store/detail\.asp$ /${mapfile:%1}.aspx [NC,R=301,L]
Thanks in advance!
Chip
- Code: Select all
http://www.domain.com/store/search_results.asp?txtsearchParamTxt=&txtsearchParamCat=8&txtsearchParamType=ALL&txtsearchParamMan=ALL&txtsearchParamVen=ALL&txtFromSearch=fromSearch&iLevel=2&subcat=93
I'm using a map file now for the simpler redirects, but I'd like to create a separate map file just for these and provide a new static URL to 301 them to. I don't even know what the old parameters are, so I'm going to have to go through them one by one and figure out the context of what people were trying to link to. I only have about 40, so it shouldn't take too long.
Here's one of our current rules:
RewriteMap mapfile txt:mapfile.txt
RewriteCond %{QUERY_STRING} ^product_id=(.+)$
RewriteCond ${mapfile:%1|NOT_FOUND} !NOT_FOUND
RewriteRule ^store/detail\.asp$ /${mapfile:%1}.aspx [NC,R=301,L]
Thanks in advance!
Chip
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Redirect nasty multi parameter URL
Did you provide the requested URL or resulting?
And what would be the issue you're struggling with? Is it capturing the names of the parameters? The values? NOt sure I understand what you're looking for.
Regards
Andrew
And what would be the issue you're struggling with? Is it capturing the names of the parameters? The values? NOt sure I understand what you're looking for.
Regards
Andrew
Re: Redirect nasty multi parameter URL
Thanks Andrew,
I should have described my need in a more direct fashion.
So all I really want to do is redirect the above example URL and 301 redirect it to our new simple URLs like this one:
I don't want to, and really can't, parse out each parameter. I other words are rule that says "if you exact match this old bad dynamic URL, send it to this new static URL". I was wanting to do it in a map file, but that may not make sense.
Thanks
Chip
I should have described my need in a more direct fashion.
So all I really want to do is redirect the above example URL and 301 redirect it to our new simple URLs like this one:
- Code: Select all
http://www.domain.com/Tip-Out-Trays-C15.aspx
I don't want to, and really can't, parse out each parameter. I other words are rule that says "if you exact match this old bad dynamic URL, send it to this new static URL". I was wanting to do it in a map file, but that may not make sense.
Thanks
Chip
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Redirect nasty multi parameter URL
crystal clear now )))
I'd try to do this:
and in mapfile have this:
Regards
Andrew
I'd try to do this:
- Code: Select all
ewriteEngine on
RewriteBase /
RewriteMap mapfile txt:mapfile.txt
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteCond ${mapfile:%1|NOT_FOUND} !NOT_FOUND
RewriteRule ^store/search_results\.asp$ ${mapfile:%1}? [NC,R=301,L]
and in mapfile have this:
- Code: Select all
txtsearchParamTxt=&txtsearchParamCat=8&txtsearchParamType=ALL&txtsearchParamMan=ALL&txtsearchParamVen=ALL&txtFromSearch=fromSearch&iLevel=2&subcat=93 /Tip-Out-Trays-C15.aspx
Regards
Andrew
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 10 guests