I was asked to figure out a way to make a dynamic redirect, so here i am ,asking for help :)
I would like to accomplish the following.
If someone visits
URL 1: http://www.example1.com/somefolder/12324567
REDIRECT TO
URL 2:: http://app.example2.com/ecosuite/applic/shoplink/shoplink.php?msdsCid=1004730&viewForm=pdf&msdsLang=2&msdsEr=1234567
Everything in URL 2 , is static besides the LAST entry, which is a partnumber, and is the ONLY value that will change.
Is this at all possible with url_rewrite, in my mind it should be :)
You can put in .htaccess
file in the /somefolder
directory:
RewriteEngine on
RewriteRule (\d+) http://app.example2.com/ecosuite/applic/shoplink/shoplink.php?msdsCid=1004730&viewForm=pdf&msdsLang=2&msdsEr=$1 [L]
If your id is not only numbers, you can change RewriteRule (\d+)
in (.+)
If you prefer to use root .htaccess
with more than one domain, you can use:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?example1\.com$
RewriteRule ^somefolder/(\d+) http://app.example2.com/ecosuite/applic/shoplink/shoplink.php?msdsCid=1004730&viewForm=pdf&msdsLang=2&msdsEr=$1 [L]