Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-25-2012, 10:56 PM   PM User | #1
Phred
New Coder

 
Join Date: Oct 2009
Posts: 40
Thanks: 4
Thanked 0 Times in 0 Posts
Phred is an unknown quantity at this point
Question How Can I Make Server Check Itself?

I want to restrict access to certain pages based upon where the visitor came from. For example, if someone clicks a link on a page that is hosted on www.mydomain.com then they can see the file.

But if someone tries to access that file by entering its url into the goto window, then they get sent elsewhere. Basically if the referring url is either blank, or is not www.mydomain.com, then the visitor is redirected.

I have a script that works, but I must input the name of the domain it is running on to make it work, like this:

RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?mydomain\.com [NC]

I want to be able to copy and paste the code onto any server and have it work without having to edit the name of the domain.

This is what I am using, but it doesn't work:

RewriteCond %{HTTP_REFERER} ^!{SERVER_NAME} [NC]

Is there any way to make this work?
Phred is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:48 PM.


Advertisement
Log in to turn off these ads.