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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

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

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

URL Rewriting

Go to End

4 Posts   3342 Views


Community Member, 3 Posts

10 July 2009 at 6:26am

I want to modify the .htaccess file so that the traffic directed to is redirected to

I tried
RewriteCond %{HTTP_HOST} ^$
RewriteRule ^(.*)$$ /$1 [r=301,nc]

But nothin seems to work , please help.


Community Member, 7 Posts

20 July 2009 at 9:56pm

Edited: 20/07/2009 10:02pm

I'm having quiet similar problem.

While trying to do blog claim on technorati, it fails. It might be due to the reason that part of the url is being stripped by Technorati. ->
Silverstripe redirects ->

Have anyone found a solution for this problem?


Community Member, 7 Posts

27 August 2009 at 11:41pm

Edited: 28/08/2009 12:01am

My workaround for the blog redirect problem
NB! Works only with apache server rewritter

Add the 2 following lines into .htaccess file after RewriteEngine On on line 10


RewriteCond %{REQUEST_URI} ^/([\w_-]+)([^/]{1})$
RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]



Community Member, 3 Posts

9 December 2014 at 12:24pm

Edited: 09/12/2014 12:25pm

For anyone seeing this issue on SilverStripe 3.1, I used the following code in my .htaccess to resolve the issue (as suggested by lestatron)

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

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

# This denies access to all yml files, since developers might include sensitive
# information in them. See the docs for work-arounds to serve some yaml files
<Files ~ "\.ya?ml$">
	Order allow,deny
	Deny from all

ErrorDocument 404 /assets/error-404.html
ErrorDocument 500 /assets/error-500.html

<IfModule mod_rewrite.c>
	RewriteEngine On	

	RewriteRule ^vendor(/|$) - [F,L,NC]
	RewriteRule silverstripe-cache(/|$) - [F,L,NC]
	RewriteRule composer\.(json|lock) - [F,L,NC]

	## Add these two lines to fix adding ?url= to urls where folders exist (e.g. like /blog)
	RewriteCond %{REQUEST_URI} ^/([\w_-]+)([^/]{1})$
	RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]

	RewriteCond %{REQUEST_URI} ^(.*)$
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteCond %{REQUEST_URI} !\.php$
	RewriteRule .* framework/main.php?url=%1 [QSA]

	RewriteCond %{REQUEST_URI} ^(.*)/framework/main.php$
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule . %1/install.php? [R,L]