Home » Htaccess Tools » Questions regarding htaccess » Allow from specific page only?
Allow from specific page only? [message #526] Thu, 10 August 2006 15:12 Go to next message
Michael Walker  is currently offline Michael Walker
Messages: 2
Registered: August 2006
Location: Cambridge, UK
May I, firstly, apologise if this question has already been asked or answered here.

I would like to use htaccess to restrict access to a particular web page. The situation is this: I have a 'members-only' area on my site which requires a username and password for access (not htaccess, it's a phpbb portal). One of the links which members can only see once they are logged in takes them to a further page. However, I want to stop people being able to bypass the initial login by just book-marking the url of this further page. So, I need something which will do something like this: "Check that the visitor is arriving from www.mysite/portal/linkspage.php. If they are, let them in, if not, redirect to anotherpage.php"
I realise I can specify a URL to allow from, but this needs to be one specific page/file within the allowed URL only.

Hope I have explained this clearly. A sample file - if such a thing is possible - would be hugely appreciated
Allow from specific page only? [message #533] Wed, 16 August 2006 13:35 Go to previous messageGo to next message
andreas  is currently offline andreas
Messages: 239
Registered: January 2005
Location: Denmark

Site Admin
The following code should do it:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://www.mysite/portal/linkspage.php [NC]
RewriteRule .* http://www.mysite/portal/loginpage.php [L]
Allow from specific page only? [message #535] Wed, 16 August 2006 15:11 Go to previous message
Michael Walker  is currently offline Michael Walker
Messages: 2
Registered: August 2006
Location: Cambridge, UK
That is most kind of you - many thanks.
Previous Topic:I know I am a Newbie with htaccess.
Next Topic:.htaccess and custom error pages
Goto Forum:
  


Current Time: Sat May 17 07:35:49 CEST 2008

Powered by: FUDforum 2.7.7.
Copyright ©2001-2007 FUD Forum Bulletin Board Software