I'm trying to do this with .htaccess. So what I did was set a cookie named "domain" with the website I'm redirecting to. In my .htaccess file I have this
RewriteEngine on
RewriteCond %{HTTP_COOKIE} domain=([^;]+) [NC]
RewriteRule ^(.*)$ %1/$1 [L]
I got that code from a Google search. It's supposed to reditect http://mywebsite.com/something to http://someotherwebsite.com/something. But it's not working. Any tips?
Edit: I still haven't been able to get it to work. A temporary solution I'm using is using PHP to get the cookie value and redirect that way.