Mapfile to redirect to remote URL
3 posts
• Page 1 of 1
Mapfile to redirect to remote URL
Hi,
I frequently use the following code with a mapfile in order to rewrite URLs within a site. However I need to use the same method but to result in a remote URL.
RewriteMap mapfile txt:mapfile.txt
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteCond ${mapfile:%1|NOT_FOUND} !NOT_FOUND
Rewriterule ^product\.aspx$ /${mapfile:%1}? [NC,R=301,L]
Here is what I need it to do:
http://myfirstsite.com/product.aspx?productid=12345
to redirect to
http://mysecondsite.com/someotherpage
with the mapfile reading:
productid=12345 someotherpage
Thanks!
I frequently use the following code with a mapfile in order to rewrite URLs within a site. However I need to use the same method but to result in a remote URL.
RewriteMap mapfile txt:mapfile.txt
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteCond ${mapfile:%1|NOT_FOUND} !NOT_FOUND
Rewriterule ^product\.aspx$ /${mapfile:%1}? [NC,R=301,L]
Here is what I need it to do:
http://myfirstsite.com/product.aspx?productid=12345
to redirect to
http://mysecondsite.com/someotherpage
with the mapfile reading:
productid=12345 someotherpage
Thanks!
Re: Mapfile to redirect to remote URL
Hello Johnny,
Please try adding the domain name to the resulting URL like this:
RewriteMap mapfile txt:mapfile.txt
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteCond ${mapfile:%1|NOT_FOUND} !NOT_FOUND
Rewriterule ^product\.aspx$ http\://mysecondsite.com/${mapfile:%1}? [NC,R=301,L]
Please try adding the domain name to the resulting URL like this:
RewriteMap mapfile txt:mapfile.txt
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteCond ${mapfile:%1|NOT_FOUND} !NOT_FOUND
Rewriterule ^product\.aspx$ http\://mysecondsite.com/${mapfile:%1}? [NC,R=301,L]
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 23 guests