views:

118

answers:

1

Hello,

I like to access my download.php with ajax, that way I can show a little downloadscreen in a div, BUT

I have this in my htaccess file, that basicly says deny outside access for all pages. I forgot about it, while I was trying to access my download.php file

with window.location = urlnieuw

Is there a workaround for this problem and still keep the download.php protected against direct access??

or just trigger a jquery event, when the link is clicked

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

edit the htaccess does not prevent direct access to files

thanks in adv, Richard

+1  A: 

Why do you think your mod_rewrite rule will prevent access from remote? The given rule will just rewrite requests of any URL that cannot be mapped directly to an existing file or directory to the index.php. There are no restrictions on who can or cannot access.

Gumbo
I figured it out, I was causing it myself, I thought it was the htaccess. Next question is howto prevent direct access to files, includes. But I will search for that first, because I am not to familiar htaccess files.
Richard
You can test if a `.php` was requested: `RewriteCond %{THE_REQUEST} ^[A-Z]+\ /[^?\ ]*\.php[/?\ ]`
Gumbo
thanks,I wasn´t expecting an answer anymoreI was looking all over the placeI try´d this also, but it was causing some strange neverending loop RewriteCond %{HTTP_REFERER} !^$RewriteCond %{HTTP_REFERER} !^http://(www\.)?domain/.*$ [NC]RewriteRule \.(gif|jpg|php|html|png)$ http://www.domain.nl/images/logo.gif [R,L]does your rule not interfear with the index.php
Richard
can you let it affect only the include files in the include folderI guess in your example I could replace THE REQUEST with the file name.And multiple files are comma separate|questionmark|. Here go´s my keyboard again.
Richard
@Richard: You can use this rule to respond with a 404 on requests of `/include/…`: `RewriteRule ^include($|/) - [L,R=404]`
Gumbo
Got a big internal server error, when using the last rule. The sever says something wrong with the internal configuration?
Richard