Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS

Use standalone PHP in a subdirectory


Reply

19 Posts   4508 Views

Avatar
SilverRay

3 June 2009 at 4:46pm (Last edited: 3 June 2009 4:47pm), Community Member, 167 Posts

Ah, got you. Because of Ingo's wording I actually thought he meant the file itself (Sorry about that ;)

Clear! And thanks, because I actually need this exact functionality for a shopping cart that wants to look into a .php file in some directory in order to do url replacement so the store looks like it is under the real site's domain...

Avatar
borriej

1 June 2010 at 9:42pm (Last edited: 1 June 2010 9:50pm), Community Member, 267 Posts

RewriteCond %{REQUEST_URI} !/directoryname

doesn't work for me. Added this rule in my .htaccess, which is in the root. Replaced directoryname for my oscommerce admin folder (www.mydomain.com/catalog/admin)

But i always get the SS error: page not found, but it does exist
Also see: http://www.silverstripe.org/general-questions/show/285405?start=0#post285464

htaccess code:

### SILVERSTRIPE START ###
<Files *.ss>
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Files>

htaccess looks like this:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} !(\.gif$)|(\.jpg$)|(\.png$)|(\.css$)|(\.js$)

RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
RewriteCond %{REQUEST_URI} !/http://www.mydomain.nl/webshop/catalog/admin/

</IfModule>

### SILVERSTRIPE END ###

Why doens't it work?

Avatar
Willr

1 June 2010 at 10:20pm Forum Moderator, 5511 Posts

@borriej you have to have all the conditions before the rules in the .htaccess file AFAIK.

Avatar
borriej

1 June 2010 at 10:23pm Community Member, 267 Posts

@Willr, thankyou for your reply.

Im new to this: which are the other conditions?

Avatar
Willr

1 June 2010 at 10:32pm Forum Moderator, 5511 Posts

Iin your file

RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
RewriteCond %{REQUEST_URI} !/http://www.mydomain.nl/webshop/catalog/admin/

I think it needs to be like

RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !/http://www.mydomain.nl/webshop/catalog/admin/
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]

All the RewriteCond which are Rewrite Conditions *before* the rule

Avatar
borriej

1 June 2010 at 10:40pm Community Member, 267 Posts

Ok re-ordered the lines, but it still says: page not found.

Avatar
Willr

1 June 2010 at 10:45pm Forum Moderator, 5511 Posts

Try using a sub folder name instead of your the full url last condition.

RewriteCond %{REQUEST_URI} !^/webshop/catalog/admin

Avatar
borriej

1 June 2010 at 11:01pm Community Member, 267 Posts

sorry, but that also doesn't work.

Is this really the way to exclude SilverStripe from looking into some folders?

Is there another way to make sure SS doesn't say 'page not found' in 'Non-SilverStripe-Folders?'