Home

Using other systems together with Silverstripe

Silverstripe uses mod_rewrite to catch all calls to your website in the form of urls and route them to sapphire/main.php. This behavior is implemented with the rules in your .htaccess file in the root of your site. This can become a problem when you want to use other systems together with Silverstripe because you simply can not reach the url of those other systems.

An example: if your want to use phplists as a newsletter system, it is usually installed under yoursite.com/lists. However, under normal circumstances you can not have your visitors reach yoursite.com/lists when using Silverstripe because it is rerouted to sapphire/main.php?url=lists.

This behavior can be changed by adding a rule to your .htaccess file. I use this one:

(This snippet has to appear before the RewriteRule that routes everything to sapphire/main.php otherwise it wont work.)

What does this do? If someone tries to access an address on your site in a folder starting with an underscore (_) do not apply rules to it (and therefore do not route it to sapphire/main.php). 

What can you do with it? If you create a folder in your site starting with an underscore (for example: _lists) it will be ignored by silverstripe. So if you install phplists there (or any other system or a static html/flash site) you can simply use it without problem along with Silverstripe in the same site.

I have tested this with Silverstripe 2.3+ and 2.4 Beta1

 

About the Author

Name: Yuri Goul

Website: http://www.alien-saints.com

Comments (5)

  • http://http://www.findsoso.com/

    Our website wholesale for many kinds of fashion clothing, such
    as nike,jordan,prama,****, we also sell jeans,shirts,bags,hat and
    many kinds of tiffany. All the products are free shipping, and the
    the price is enticement , and also can accept the paypal
    payment.we can ship within 24 hours after your payment.

    accept the paypal

    free shipping

    competitive price

    any size available



    Everything is here http://www.findsoso.com friends, please
    enjoy viewing bar

    Thanks

    Posted by xihuan, 27/09/2010 10:14am (4 years ago)

  • Thanks for such an informative article, it's been very useful.

    Posted by russian women, 22/09/2010 2:39pm (4 years ago)

  • it is of course:
    RewriteCond %{REQUEST_FILENAME} !-d
    when dealing with a directory.

    you can use one or both of these statements depending on what you want to do.

    you may also need to specify the location first using:
    RewriteCond %{DOCUMENT_ROOT}/path/to/web/root
    I haven't tried it myself yet so not sure if it works without this.

    Posted by Richard, 17/06/2010 5:53pm (4 years ago)

  • could you not use:
    RewriteCond %{REQUEST_FILENAME} !-f
    or similar to test if the directory/file exists first before redirecting? that way it doesn't matter what you call the directory.

    Posted by Richard, 17/06/2010 5:37pm (4 years ago)

  • Another option is to put a .htaccess file in the relevant folder with only the statement RewriteEngine Off. That should solve this problem and if the other system uses .htaccess rewrite rules itself there probably won't be any collision.

    Posted by Marcus, 24/03/2010 10:42am (5 years ago)

RSS feed for comments on this page RSS feed for all comments

Post your comment

Comments have been disabled. Please visit this post on SSBits.com to post your comment