Jump to:

17452 Posts in 4473 Topics by 1971 members


SilverStripe Forums » Archive » Changing the URL layout

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

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

Page: 1
Go to End
Author Topic: 2673 Views
  • Scott
    Community Member
    3 Posts

    Changing the URL layout Link to this post

    Is there a way to drop the / at the end of URLS and add .html or something similar?

    If this isn't possible, where is the function that constructs URLs? If this can be adapted, then mod_rewrite can be used to rewrite .html to /.


  • Sigurd
    Forum Moderator
    628 Posts

    Re: Changing the URL layout Link to this post

    Is this to ensure old website URLs are retained, or because you have a preference for the .html extension?

    You could .htaccess to accept the .html extension and pass it to sapphire/main.php, however SilverStripe would continue to write links on the page to the normal format.

  • Dudley
    Community Member
    1 Post

    Re: Changing the URL layout Link to this post

    Hi Sigurd,

    I saw this post, but it looked like it never continued. I'm also looking to do exactly as you noted, preserve all existing URLs by allowing for ".html" to be at the end of the URL instead of "/". I'd also like to have the URL sections divided up into separate directories using "/".

    So, for instance, we have an original URL that appears:


    We don't want to change ANYthing about the URL and fuss with current rankings or inbound links (even with a redirect). Currently, with Silverstripe, we can only accomplish this:


    Should edits to the main.php file be able to resolve this? I know the validation in the Meta-Data section seems fairly strict about choosing non-alphanumeric characters. Can this limitation be manually removed without a cascade affect of related issues?

    ~ Dudley

  • mbellino
    Community Member
    32 Posts

    Re: Changing the URL layout Link to this post


    I have the same need, preference regarding the URL layout.
    Not only the missing page extension but also the very flat url structure could be a problem.

    SilverStripe uses a "root structure".

    Independent of the site structure and path deepness the URL looks like this: http://mydomain.com/my-first-page/ .

    Ending slash is treated as folder structure with containing sub-pages if you use Google Analytics. Particularly if you have a lot of pages with a clear parent/child structure this could prove to be difficult for analysing purpose. With the actual path logic I don't see any potential to have cumulated reports for grouped pages (e.g. all product pages, all services, etc.), because there is no common path denominator.


    Good luck if you have to analyze a website with a hundred pages on the root.

    ==> Would be nice if you could discuss this point for a next major release )



  • Fuzz10
    Community Member
    787 Posts

    Re: Changing the URL layout Link to this post

    Hi Guys,

    This is a subject that keeps on coming back on the forum. There are some workarounds, but I think the overall feeling is that this needs to be done. It's just not so easy to do .... ;)

    Let's try to keep the discussion about this in 1 thread.

    See for example : http://www.silverstripe.com/extending-hacking-silverstripe-forum/flat/526?start=0

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.