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.

Archive

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

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

Rewrite Rule


Reply

7 Posts   1653 Views

Avatar
Frank_08

5 December 2008 at 12:24am (Last edited: 5 December 2008 12:25am), Community Member, 12 Posts

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

5 December 2008 at 12:39am Community Member, 395 Posts

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

5 December 2008 at 1:27am (Last edited: 5 December 2008 2:46am), Community Member, 12 Posts

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

5 December 2008 at 2:08am 121 Posts

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

5 December 2008 at 2:55am Community Member, 12 Posts

I tried that jam13 but it didn't work.

Avatar
jam13

5 December 2008 at 3:45am 121 Posts

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

5 December 2008 at 4:06am (Last edited: 5 December 2008 4:13am), Community Member, 12 Posts

Works!! Thanks a lot!