Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a Wordpress installation on the root of an apache (I.E. on /) and WP wrote this custom .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Now I need to hide a single php script, let's say in /scritps/hello.php, I tried a .htaccess in /scripts with:
<files hello.php>
Order allow,deny
Deny from all
</files>

But it gets overriden by WP's .htaccess, and hello.php is shown anyway. (I know this because moving the scripts directory out of WP to another vhost on my local environment makes it work.

I want to hide this php file on the live site because it should only be called by cron from the command line, and I can't put the file outside the apache root because that's all I have FTP access to.
And no, I don't have SSH access, someone else's going to set the cron job.

share|improve this question
add comment

1 Answer

Remove the other .htaccess from the sub-directory and try putting this in the .htaccess in your root directory:

<Directory /scripts>
    Order allow,deny
    <Files hello.php>
       Deny from all
    </Files>
</Directory>
share|improve this answer
    
Nope, doesn't work either. –  Petruza Dec 15 '11 at 20:22
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.