301 redirect refuses to redirect .aspx pages?

Hi all,

I’ve found what seems to be a bug and I can’t seem to uncover why it happens.

I’ve got lots of 301 redirects in my .htaccess and all work fine except for the ones ending in .aspx extensions.

Anyone encountered this before?

Here’s one that doesn’t work and always yields a 404 on the merchant’s website.

redirect 301 /merchant1/info/terms-of-sale http://track.webgains.com/click.html?wgcampaignid=66149&wgprogramid=2600&clickref=MERCHANT1&wgtarget=http://www.crucial.com/uk/company/termsofsale.aspx

If I paste “http://track.webgains.com/click.html?wgcampaignid=66149&wgprogramid=2600&clickref=MERCHANT1&wgtarget=http://www.crucial.com/uk/company/termsofsale.aspx” in the browser it opens up just fine, if it goes via Apache’s 301 redirect things go wrong.

What gives? :rolleyes:

Many thanks,

Thanks for your reply.

Indeed, what you pasted in above seems to make some sense. For now I changed the old url from /merchant1/info/terms-of-sale to /merchant1/terms-of-sale and it works.

It seems too many forward slashes /'s cause it to fail.

I’ve looked online but couldn’t find clues regarding the additional syntax I need to setup mod_rewrite. I’ve also encountered references to RedirectMatch though this is more suitable for redirecting groups of url’s in one go.

If I can find the extra code I’ll make the old url’s longer, if not I’ll keep them short (only one /).

Just wanted to add that doing it via RedirectPermanent doesn’t work either.

I’ve searched 30 or so pages on Google but nothing. I’m amazed that no one has ever attempted to redirect to an .aspx page via Apache’s .htaccess.

It’s got to be a .htaccess setting but what?


I’m not an expert on mod_alias but I suspect that the problem is that mod_alias doesn’t deal with query strings. A review of Apache Module mod_alias seems to verify this without saying so in so many words. Please note the third paragraph:




IMHO, it has nothing to do with the number of /'s, just the mixing of the {QUERY_STRING} variable with the {REQUEST_URI} variable.

If you need info on mod_rewrite, why not start with the tutorial article linked in my signature? That’s what it’s there for.