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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

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

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

Rewrite Rule


Go to End


7 Posts   2465 Views

Avatar
Frank_08

Community Member, 12 Posts

5 December 2008 at 12:24am

Edited: 05/12/2008 12:25am

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

Avatar
Nivanka

Community Member, 400 Posts

5 December 2008 at 12:39am

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

Avatar
Frank_08

Community Member, 12 Posts

5 December 2008 at 1:27am

Edited: 05/12/2008 2:46am

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.

Avatar
jam13

121 Posts

5 December 2008 at 2:08am

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.

Avatar
Frank_08

Community Member, 12 Posts

5 December 2008 at 2:55am

I tried that jam13 but it didn't work.

Avatar
jam13

121 Posts

5 December 2008 at 3:45am

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?

Avatar
Frank_08

Community Member, 12 Posts

5 December 2008 at 4:06am

Edited: 05/12/2008 4:13am

Works!! Thanks a lot!