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


Go to End
Reply

19 Posts   4499 Views

Avatar
Double-A-Ron

15 April 2009 at 2:42pm Community Member, 604 Posts

Should be a pretty simple one:

I've got a directory that I have dropped into my Silverstripe root directory called "custom". In this directory, I have a php page called index.php, amongst others.

Obviously, when I try to open www.domain.com/custom/, The SS rewrite engine kicks in and tries to find a CMS page that doesn't exist.

How can I modify this behavior on a per directory basis?

And, no, I don't want to use a redirector page either. These pages are all process pages and I don't want them in the SiteTree.

Cheers
Aaron

Avatar
Nivanka

15 April 2009 at 3:00pm Community Member, 395 Posts

I think you can access the page with the actual URL to the file.
Something like this I mean www.domain.com/custom/index.php

Avatar
Double-A-Ron

15 April 2009 at 4:24pm (Last edited: 15 April 2009 4:25pm), Community Member, 604 Posts

Er, that would have been the first thing I tried to actually find this problem in the first place, don't you think?

No, that doesn't work obviously. I'm told that the page doesn't exisit, which is the CMS throughing it's page-not-found handler.

Avatar
Ben Gribaudo

16 April 2009 at 12:25am Community Member, 181 Posts

What's your .htaccess file look like?

Avatar
briso

18 May 2009 at 10:17am Community Member, 1 Post

I'm new to SS.

I'm trying to get a Virtual Tour based around PHP script going. It runs as per normal on various other sites/hosting.

It's sitting in a directory/folder outside SS but when it runs it just displays the generated HTML code.

Even simple Hello World or phpinfo.php script does the same.

I've found some info within this forum which indicates the SS processes everything delivered from the site even if it's external to SS, but I can't find a definitive procedure to have PHP run normally as it does on non SS sites.

Does the answer lie in a mod to php.ini , .htaccess , SS or anywhere else?

Can anyone point me in the right direction?

Avatar
Ingo

2 June 2009 at 10:08am Forum Moderator, 801 Posts

If you include a file called "__manifest_exclude" in a folder, SilverStripe will ignore it.

Avatar
SilverRay

2 June 2009 at 1:16pm Community Member, 167 Posts

Hmm. If I have a directory called "haha" in root, and a file in it called "__manifest_exclude", the url http://www.mydomain.com/haha/ still goes to Silverstripe's error page... also when I name the file "_manifest_exclude" with one underscore as is described here: http://doc.silverstripe.com/doku.php?id=changelog&s=manifest%20exclude

Bug maybe? Using version SS 2.3.1

Avatar
rbquirke

3 June 2009 at 10:43am Community Member, 70 Posts

No, this is not a bug.

What Ingo was talking about prevents the php from being included into the SilverStripe codebase.
If you want to actually access that directory directly, you will need to tell .htaccess not to use the Silverstripe for that directory.

You need to add line to your .htaccess file like:
RewriteCond %{REQUEST_URI} !/directoryname

where directoryname is the name of the directory with your files

Go to Top