I'm trying to use cname and http redirect to hide that I'm linking to other domains on my site. I know how to setup the cname through my hosting service, but I'm unsure how to setup the http redirects. Do I need to setup each redirect link in the .htaccess file? Is there an easier and more efficient way?
Asked
Active
Viewed 417 times
1 Answers
2
I'm guessing that you are using the Apache webserver. You'd want to use the Apache mod_rewrite and mod_proxy modules.
Because you want to hide the original domain you have to proxy through your webserver. Note that this feature is not available at some hosting providers for security/abuse reasons. Also note that mosts companies don't allow you to proxy their sites (content) for fishing reasons.
In your .htaccess file you can than use mod_rewrite to proxy requests to other websites:
RewriteEngine On
RewriteRule foo(.*) http://www.example.com/bar/$1 [P,L]
- Match agains Servername/DirectoryName/Foo[Wildcard everything]
- Rewrite to http://www.example.com/bar/[Insert matched wildcard]
- Proxy the request [P]
- Stop rewriting [L]
To proxy a remote image as if it's on your server you would use:
RewriteRule ^myimage.jpg$ http://www.example.com/itsactuallymine.jpg [P,L]

basvdlei
- 1,326
- 8
- 13