WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-03-2007, 01:09 AM
WebProWorld Pro
 

Join Date: Jul 2003
Location: Canada
Posts: 263
ackerley1 RepRank 0
Default .htaccess resitrict a single file

Hello,

I would like to resitrict the initial access to a single file using .htaccess. I tried through CPanel, but that is for whole directories and I don't have the know how to write this on my own.

The one file is part of a cart system that steps through the same file 4 times (Product Select, Ship/Bill info, CC info, Order Confirm). I do not want the password to be triggered each step of the way just on the initial page request.

Is there a way to do this with .htaccess?

Please advise.

Thanks

Rob
__________________
Rob Ackerley
Sovereign Web Design
www.sovereignwebdesign.com
Reply With Quote
  #2 (permalink)  
Old 07-03-2007, 09:16 AM
WebProWorld Member
 

Join Date: Oct 2006
Posts: 99
andyf RepRank 0
Default Re: .htaccess resitrict a single file

Quote:
Originally Posted by ackerley1 View Post
Hello,

I would like to resitrict the initial access to a single file using .htaccess. I tried through CPanel, but that is for whole directories and I don't have the know how to write this on my own.

The one file is part of a cart system that steps through the same file 4 times (Product Select, Ship/Bill info, CC info, Order Confirm).
I do not want the password to be triggered each step of the way just on the initial page request.

Is there a way to do this with .htaccess?

Please advise.
Rob
I don't think creating .htaccess would help you for doing so rather you should try it by writing some code for it.
__________________
Managed Dedicated Servers | cPanel Hosting
E-mail : sales @ webhosting.uk.com
Reply With Quote
  #3 (permalink)  
Old 07-03-2007, 04:12 PM
WebProWorld Pro
 

Join Date: Jul 2003
Location: Canada
Posts: 263
ackerley1 RepRank 0
Default Re: .htaccess resitrict a single file

Andyf, Could you elaborate any more on this?
__________________
Rob Ackerley
Sovereign Web Design
www.sovereignwebdesign.com
Reply With Quote
  #4 (permalink)  
Old 07-05-2007, 09:55 AM
wige's Avatar
Moderator
WebProWorld Moderator
 

Join Date: Jun 2006
Location: United States
Posts: 1,782
wige RepRank 4wige RepRank 4wige RepRank 4wige RepRank 4
Default Re: .htaccess resitrict a single file

When you use .htaccess, or more accurately an .htaccess and .htpasswd HTTP Authentication system, to password protect part of your site, the username and password are required each time a page is requested. However, the user's browser will remember the username/password combination and will send the information each time after the initial prompt, which I think is what you are trying to achieve.

Unfortunately, HTTP Authentication is a per-directory directive. This means you can only specify a directory to be protected, and not a single file. Unfortunately, this protection is done at the system level, so using a rewrite rule would not be a workaround in this case. Probably you would need to reprogram the actual page to request the username and password and store those values in a session variable. Bear in mind that unless this is done via HTTPS, the username and password are transmitted in plain text and thus not very secure.
__________________
The best way to learn anything, is to question everything.
Reply With Quote
  #5 (permalink)  
Old 07-10-2007, 09:28 AM
WebProWorld Member
 

Join Date: Oct 2006
Posts: 99
andyf RepRank 0
Default Re: .htaccess resitrict a single file

I agree ackerley1 .htaccess allows password protection at directory level and not for a certain file level.

Quote:
The one file is part of a cart system that steps through the same file 4 times (Product Select, Ship/Bill info, CC info, Order Confirm). I do not want the password to be triggered each step of the way just on the initial page request
IMHO you will have to work on Cookies and sessions through programming.....( php JSP etc. )
__________________
Managed Dedicated Servers | cPanel Hosting
E-mail : sales @ webhosting.uk.com
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Tags: , , ,



Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Single navigation file thebloke Google Discussion Forum 3 03-09-2007 06:07 PM
help regarding .htaccess file SES Trims Search Engine Optimization Forum 1 12-26-2006 07:48 PM
help regarding .htaccess file SES Trims Google Discussion Forum 3 12-08-2006 05:59 PM
site gone .htaccess file AjiNIMC Web Programming Discussion Forum 4 10-22-2004 11:07 PM
.htaccess file creation help... please WebCraft Web Programming Discussion Forum 3 10-28-2003 08:26 PM


Search Engine Optimization by vBSEO 3.2.0