Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I am handling many logical files request using the Apache server. To make the path simple I have used mod_rewrite in the httpd.conf.

Now I am planning to enforce authentication on these logical file (dynamic content) in .htaccess. Apache Documentation tells that only Files directives can be used in .htaccess.

Files directive only accept the path of the files that are present on the disk and does not support logical files. How do I overcome this? How can I give the full path of my URL to enforce diff types of authentication?

share|improve this question
add comment

1 Answer 1

An easy method would be to use a trigger, calling a php file that physically exists on the disc and calling it in your dynamic content which should trigger the password prompt.

You'd just need to use an empty php file in say /protected/ and ensure that the rest of the file isn't processed until the empty php file is read.

share|improve this answer
    
The actual problem is to set different authentication constraint on diff logical file. Can you tell me as to how do I put a constraint on logical path in the .htaccess file as location directive is not supported in .htaccess. –  user31745 Oct 15 '13 at 9:05
    
The actual problem is to set different authentication constraint on diff logical file. Can you tell me as to how do I put a constraint on logical path in the .htaccess file as location directive is not supported in .htaccess. Say for example I want to Limit on POST for path/to/logical/abc.xml and limit on GET for path/to/logical/def.xml .. How do I put constraints like this as hte paths are logical and location directive is not supported in htaccess .. –  user31745 Oct 15 '13 at 9:11
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.