I have a site setup and working well based in Silverstripe cms. I created a php script (not a plugin) that does some file conversion. I uploaded the script to the site root, and created an .htaccess inside it with “Allow from all”, and I give 777 to folder permission in order to allow access to this script from a browser. However, the site’s “page not found” page shows up instead.
Can someone explain what I’m missing here?
this is some conditionals in htaccess file:
RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
here is the current htaccess file:
Options +FollowSymlinks
### SILVERSTRIPE START ###
<IfModule mod_dir.c> DirectorySlash Off </IfModule>
RewriteEngine On RewriteBase / RewriteRule ^index.html$ http://www.domain.com/ [R=301,L] RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_URI} !^/csv_compare
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
### SILVERSTRIPE END ###
I’m not familiar with Silverstripe, but it sounds like the root htaccess might be redirecting. However, the safety of allow from all/777 is a little risky!
Edit: Looking at the htaccess at https://github.com/silverstripe/silverstripe-installer/blob/master/.htaccess:
That is telling the system to redirect to the framework if the request is not for a valid file. If you are requested a directory, that might be the problem. You could add the following before the line above: