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.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

How to disable sapphire/silverstripe framework in directory


Go to End
Reply

10 Posts   2078 Views

Avatar
Dolza

14 January 2010 at 8:34am Community Member, 10 Posts

i read it somewhere, at somepoint in time, but i can't find it again....
how do you disable the sapphire framework for a directory?

example:
I have my site in public_html/
I made a subdomain dev.mysite linked to public_html/dev
I don't want sapphire/silverstripe running in this directory.

Avatar
Willr

14 January 2010 at 9:02am Forum Moderator, 5511 Posts

You can add a condition to the .htaccess rule for it to ignore requests to a given directory.

Add this in your .htaccess file above the RewriteRule.

RewriteCond %{REQUEST_URI} !^/phpmyadmin/.*

Avatar
Dolza

17 November 2010 at 5:02am Community Member, 10 Posts

This method no longer seems to work with the current build
Is there another way to accomplish this now?

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

<Files web.config>
   Order deny,allow
   Deny from all
</Files>

<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteCond %{REQUEST_URI} ^(.*)$
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_URI} !^/phpmyadmin/.*
   RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
</IfModule>

Avatar
dompie

17 November 2010 at 10:27pm Community Member, 88 Posts

We have the following solution for this problem:

RewriteCond %{REQUEST_URI} !http://you.domain.com/directory

Avatar
Dolza

18 November 2010 at 8:51am Community Member, 10 Posts

just tried this with both the directory and exact page names as the rewrite condition, in both cases, the framework is still being applied

<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteCond %{REQUEST_URI} ^(.*)$
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_URI} !http://domain.com/post/page.ext
   RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
</IfModule>

<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteCond %{REQUEST_URI} ^(.*)$
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_URI} !http://domain.com/post/
   RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
</IfModule>

Avatar
simon_w

18 November 2010 at 10:20am Forum Moderator, 474 Posts

Personally, I just put a .htaccess in the subdirectory containing:

RewriteEngine Off

Also, if you are using mod_rewrite in the subdirectory, ensure that your rules have the L (last) flag.

Avatar
Dolza

18 November 2010 at 10:26am (Last edited: 18 November 2010 10:39am), Community Member, 10 Posts

rewrite off is the first thing i tried, is semi-applies the framework, no template, but it always shows the "home" page - assuming you use that in conjunction with the previous suggestion. If rewrite off is used alone, nothing changes what so ever and the full framework is applied and it shows page not found with your template/theme.

Avatar
Dolza

18 November 2010 at 10:46am (Last edited: 18 November 2010 11:04am), Community Member, 10 Posts

I appologize, the semi- thing was something else I tried previously.
Rewrite off does nothing

http://reiip.com/post/

public_html/.htaccess

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

<Files web.config>
   Order deny,allow
   Deny from all
</Files>

<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteCond %{REQUEST_URI} ^(.*)$
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_URI} !http://reiip.com/post/
   RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
</IfModule>
### SILVERSTRIPE END ###
AddType application/download pdf

public_html/post/.htaccess

RewriteEngine Off

Go to Top