.htaccess help

Custom Title Activated
Loyal Member
Joined
May 18, 2006
Messages
2,064
Reaction score
14
Hey people, I've been struggling with this recently. How do I restrict access to all .php files except the .php files in a certain folder: ajax?

I'm making a Facebook app and I've allowed access to all .php files from Facebook servers. However, the ajax calls aren't executed through Facebook so users are unable to execute ajax files.

Thanks in advance.

Love,
Nuklear
 
Hey people, I've been struggling with this recently. How do I restrict access to all .php files except the .php files in a certain folder: ajax?

I'm making a Facebook app and I've allowed access to all .php files from Facebook servers. However, the ajax calls aren't executed through Facebook so users are unable to execute ajax files.

Thanks in advance.

Love,
Nuklear

Outside:

php_flag engine off

Inside:

php_flag engine on

Doc

Untested.
 
That won't work because it will prevent the Facebook server from executing the scripts.

All I need is a way to throw a 403 error whenever a .php script is executed except by a certain IP. I can do this but it also applies to the ajax directory. Whenever I put in "Allow from all" in a .htaccess folder in the ajax directory, it doesn't work.
 
Many of my files already have something similar to that. But, it'll be alot easier if I can just control it with .htaccess.

Thanks for the help though.

---------- Post added at 12:10 PM ---------- Previous post was at 12:08 PM ----------

Many of my files already have something similar to that. But, it'll be alot easier if I can just control it with .htaccess.

Thanks for the help though.
 
Last edited:
Yes, that's what I have and it works. But, when I put this in a .htaccess file in the ajax directory

Code:
<Files ~ "\.(php)$">
Order deny,allow
Allow from all
</Files>

It doesn't even work. I can't execute the ajax script.
 
In the directory you want secure,
do
Code:
#Server Access Only
deny from all

In the AJAX directory,
do
Code:
#Anyone Access Anything
allow from all

My logic was backward last time. I thought you wanted to allow facebook only, but if you want it for everyone, it's much easier.
 
Last edited:
Back