Jump to:

22972 Posts in 11596 Topics by 2824 members

General Questions

SilverStripe Forums » General Questions » defining Homepage URL Segment

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

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

Page: 1
Go to End
Author Topic: 669 Views
  • Silverfish
    Avatar
    Community Member
    59 Posts

    defining Homepage URL Segment Link to this post

    Hi All,

    when requesting a page domain root (i.e. http://example.com/) silverstripes searches and displays a page with url segment 'home'.
    I am trying to run a homepage with another url segment (i.e. testing) so that if you request http://example.com, you will get redirected to http://example.com/testing and get this page displayed. I already achieved this, by entering the url segment, deleting the default 'home' age and setting "is homepage for" on the new homepage (with testing as url segment). This did work, until i ran the next /dev/build, there the systems creates a new default homepage.

    My current workaround is to create a redirector page to testing, that has 'home' as url segment. But I don't like this too much since this Redirector page may confuse the customer.

    Any Ideas anone?

    Thanks a lot

    Regards
    S.F.

  • benshu
    Avatar
    Community Member
    4 Posts

    Re: defining Homepage URL Segment Link to this post

    Hi Silverfish,

    in your _config.php file, try using:

    Director::addRules(100, array(
    '' => '->testing',
    ));

    I just discovered this while searching on something similar:
    http://www.silverstripe.org/archive/show/52

  • socks
    Avatar
    Community Member
    190 Posts

    Re: defining Homepage URL Segment Link to this post

    Looks like adding to _config is deprecated in SS3. http://doc.silverstripe.org/framework/en/reference/director

    I'm trying to add to routes.yml, but it still makes a Home page with the URL of /home. The redirect seems to work, just don't want Home when I dev/build.

    mysite/_config/routes.yml

    ---
    Name: customroutes
    After: '#coreroutes'
    ---
    Director:
    rules:
    '': '->my-custom-homepage-url'

    Any suggestions?

    Thanks

    669 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.