Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

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]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.