Forum Moderators: phranque
We're moving from one script to another (same server & domain) and the new script will be residing in the same subfolder as the old one (/downloads).
This is the sort of redirect that we're trying to accomplish:
OLD: http://www.example.com/downloads/?dlid=123
NEW: http://www.example.com/downloads/viewfile/123.html
...and here is the current applicable part of our htaccess file (in the web root):
RewriteCond %{QUERY_STRING} ^dlid=(.*)$
RewriteRule ^downloads/$ http://www.example.com/downloads/viewfile/$1.html? [R=301,L]
This is the output we're getting right now:
http://www.example.com/downloads/viewfile/.html
No matter what I try, I simply cannot get that backreference to pass into the substitution string.
My sanity skipped out hours ago. What am I doing wrong?
From my apache manual reading (quite a lot today) I think the issue lies in the fact that RewriteRule does not see the query string at all, which is why I tried to set the proper backreference with RewriteCond. I'm just stumped though at why that backreference isn't being carried forward!
If you can help me figure this out I'd be grateful:
[webmasterworld.com...]