Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Rewrite Rule

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1644 Views
  • Frank_08
    Avatar
    Community Member
    12 Posts

    Rewrite Rule Link to this post

    Hello.
    I added a folder called 'forum' to my silverstripe website where I put the forum. The problem is the I can't access it because of the modrewrite rule. I'm not very good at mod rewriting , I tried the following but didn't work:

    ### SILVERSTRIPE START ###
    <IfModule mod_dir.c>
    DirectorySlash Off
    </IfModule>

    RewriteEngine On
    RewriteBase /

    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]

    RewriteRule ^forum/(.*)$ http://%{HTTP_HOST}/forum?

    ### SILVERSTRIPE END ###

    Any help is appreciated
    Many thanks

  • Nivanka
    Avatar
    Community Member
    395 Posts

    Re: Rewrite Rule Link to this post

    you dont have to edit the .htaccess for this.

    I have been working with the forum module for a long time, and never had such an issue.

    did you install it properly? all you have to do is to run the following url

    http://yourdomainname/db/build?forum

  • Frank_08
    Avatar
    Community Member
    12 Posts

    Re: Rewrite Rule Link to this post

    Thank you for your reply. My client wants to use an exteral forum (SMF) and it doesn't necessarily have to be connected to the CMS.

  • jam13
    Avatar
    121 Posts

    Re: Rewrite Rule Link to this post

    Try putting the following just below your RewriteBase (untested):

    RewriteRule ^forum/ - [L]

    That should stop any URL starting with "/forum/" from being handled by SilverStripe.

  • Frank_08
    Avatar
    Community Member
    12 Posts

    Re: Rewrite Rule Link to this post

    I tried that jam13 but it didn't work.

  • jam13
    Avatar
    121 Posts

    Re: Rewrite Rule Link to this post

    It should work apart from the case where you use a bare folder name (no slash). An extra term would cover that:

    RewriteRule ^forum$ - [L]
    RewriteRule ^forum/ - [L]

    Is the forum software doing any rewrites too?

  • Frank_08
    Avatar
    Community Member
    12 Posts

    Re: Rewrite Rule Link to this post

    Works!! Thanks a lot!

    1644 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.