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

Removal of /home redirection


Go to End


6 Posts   2706 Views

Avatar
steki

Community Member, 4 Posts

10 May 2007 at 8:21pm

I created patch that disables primary redirection for site from
"http://www.somesite.com/" to "http://www.somesite.com/home/"
and if someone tries to get http://www.somesite.com/home or http://www.somesite.com/home/ will be redirected to http://www.somesite.com/

Patch location: http://www.steki.net/code/download/silverstripe/
home_redir_removal.diff

Boris

Avatar
Tim

Community Member, 201 Posts

11 May 2007 at 12:51pm

Edited: 11/05/2007 12:53pm

Thanks for this Boris - Andrew, can you please make sure this finds its way into the main branch :-)

Avatar
elijahlofgren

Google Summer of Code Hacker, 222 Posts

17 May 2007 at 8:36am

Nice patch Boris!

It looks like 1 line was left out of this patch when it was applied and I get this error:
"Notice: Undefined variable: surl in /var/www/silverstripe/sapphire/main.php on line 110"

This 1 line patch adds in the missing line to fix the error and make the redirection work:
http://www.elijahlofgren.com/silverstripe/patches/Add-missing-surl-silverstripe.2.0.DailyBuild.2007-05-16.patch

Avatar
Sam

Administrator, 690 Posts

6 June 2007 at 11:46am

I didn't like the fact that this patch added a lot of code to main.php that was replicating code in RootURLController and Director. So I've patched SVN so that ContentController calls a new method called RootURLController::should_be_on_root($currentPage) to decide when to redirect from home/ to /.

It fixed some bugs with the system that were breaking on my local dev environment, and it also will now redirect home/?getvar=1 to /?getvar=1.

It doesn't redirect if there's an action (home/something) or post variables. It makes use of $controller->urlParams prepared by the director, rather than processing $_GET['url'] itself.

Avatar
Decisive Flow

Community Member, 73 Posts

25 July 2007 at 12:19pm

Edited: 25/07/2007 12:19pm

woohoo was hoping for this... how do we go about getting it?

Avatar
Tim

Community Member, 201 Posts

25 July 2007 at 1:32pm

You'll need to update your version of SilverStripe to 2.0.2