Forum Moderators: phranque
For instance, I'd like to redirect users coming from abc1.com, abc2.com, and abc3.com, but allow everyone else.
Does anyone have such a htaccess file? I would involve mod rewrites, I believe.
Welcome to WebmasterWorld [webmasterworld.com]!
Here's a good place to start: Introduction to mod_rewrite [webmasterworld.com]
While we'll be happy to help you get your code working or to discuss it abstractly, our focus here is not a "code-writing service." Our charter [webmasterworld.com] outlines what we do here.
Another possibility is to try this site search [google.com] for previous threads to help you get started.
Be aware that using referrer info for redirects is not reliable. Many users (welcome and unwelcome) who visit your site through caching proxies or firewalls will not have a referrer. Also, direct-type-in-URL visitors and right-click-save users won't have a referer. URLs requested by JavaScript on your pages won't, either. Therefore, if you block blank referrers, you will inadvertently block some of your legitimate visitors.
You can achieve a partial block by redirecting visitors who *do* provide an unauthorized referer. This will take care of about 75% of your problems. Then, either live with the rest, or implement a password-type authorization or a cookie-based tracking scheme to block unauthorized access - It all depends on your goals, how important this is to you, and how much time you want to put into it.
Jim