I have already looked at the How do I call legacy PHP files? answers and they didn't fix my problem.

I have a custom php file in my Drupal site (Hosted on Acquia Cloud and I am working on a local version of the site using Acquia Dev Desktop) that needs to be accessable, I added these lines to my .htaccess file trying to allow access to the php file

RewriteCond %{REQUEST_URI} !^/learning/
RewriteCond %{REQUEST_URI} !^/learning/sales/[^/]*\.php$
RewriteCond %{REQUEST_URI} !^/learning/sales/index.php
RewriteCond %{REQUEST_URI} !^/learning/sales/ajax/[^/]*\.php$

But I still get this response trying to go to the index.php file. "Forbidden You don't have permission to access /learning/sales/ on this server."

How can I fix this?

Note: if I change the file to be index.html it works just fine (well my ajax call in it doesn't work but it atleast loads) but if it is index.php it returns with the 403 error.


This should do the trick:

 RewriteCond %{REQUEST_URI} !/learning/[^/]*\.php$

For more info please look at this thread, unable to run custom php script inside drupal.

  • I tried that and read the entire thread and none of those worked for me. it is still giving me a 403 error, would that mean that the problem might be related to something else? – Eluchel Jun 24 '19 at 18:38
  • Have you cleared the cache? – user72672 Jun 24 '19 at 18:39
  • do you mean the drupal site cache or my browser cache? I am just tried the drupal cache and no luck. – Eluchel Jun 24 '19 at 18:40
  • Maybe the files don't have the correct permission? – user72672 Jun 24 '19 at 18:42
  • Maybe, but when I look at the files on my computer (running a local Acquia Dev Desktop version of the site) it looks like their permissions are 777 so that shouldn't be a problem right?) – Eluchel Jun 24 '19 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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