Forum Moderators: phranque
RewriteMap oldlinks txt:/var/www/sitedir/.htoldlinks
RewriteCond %{REQUEST_URI}!=""
RewriteCond ${oldlinks:%{REQUEST_URI}¦NOT-FOUND}!=NOT-FOUND
RewriteRule ^.* ${oldlinks:%{REQUEST_URI}} [R=301,L]
and in .htoldlinks i have
/index.cfm?query1=text1 /newdir/newpage1.html
/index.cfm?query1=text2 /newdir/newpage2.html
/anotherpage.cfm?query1=text1 /newdir/newpage3.html
etc...
I have old links from other sites taht are no longer maintained under the same URI. I know the old URI's and where they need to go. However, the rewrite doesn't match any of the requests at all.
in the rtewrite log file i get
init rewrite engine with requested uri /index.cfm
applying pattern '^.*' to uri '/index.cfm'
RewriteCond: input='/index.cfm' pattern='!=""' => matched
cache lookup FAILED, forcing new map lookup
map lookup FAILED: map=oldlinks[txt] key=/index.cfm
RewriteCond: input='NOT-FOUND' pattern='!=NOT-FOUND' => not-matched
indicating that the REQUEST URI is not using the query string too, although it should.
If I add the line to my .htoldlinks file
/index.cfm /newdir/newpage1.html
Thanks again
Wing
I changed my httpd.conf to reflect this and it now works. here's what I have now
RewriteCond %{QUERY_STRING}!=""
RewriteCond %{REQUEST_URI}!=""
RewriteCond ${oldlinks:%{REQUEST_URI}?%{QUERY_STRING}¦NOT-FOUND}!=NOT-FOUND
RewriteRule ^.* ${oldlinks:%{REQUEST_URI}?%{QUERY_STRING}} [R=301,L]
however, I am getting forwarded to
/newdir/newpage1.html?query1=text1
/newdir/newpage1.html
Any ideas on how to blank out the query string?