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

Changing the URL layout


Go to End


5 Posts   3492 Views

Avatar
Scott

Community Member, 3 Posts

31 March 2007 at 7:45am

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

Thanks,
Scott.

Avatar
Sigurd

Forum Moderator, 628 Posts

3 April 2007 at 2:37pm

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.

Avatar
Dudley

Community Member, 1 Post

6 December 2007 at 6:25am

Edited: 06/12/2007 6:26am

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:

http://www.example.com/tutorials/example01.html

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:

http://www.example.com/tutorials-example01/

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?

Thanks,
~ Dudley

Avatar
mbellino

Community Member, 32 Posts

13 December 2007 at 1:33am

Edited: 13/12/2007 11:11pm

Hello

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/ .
http://mydomain.com/my-second-page/
http://mydomain.com/my-third-page/
http://mydomain.com/my-third-sub-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.

http://mydomain.com/products/my-first-product/
http://mydomain.com/products/my-first-product/my-first-sub-product
http://mydomain.com/products/my-second-product/
http://mydomain.com/products/my-third-product/

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 :-))

Regards

Mario

Avatar
Fuzz10

Community Member, 791 Posts

14 December 2007 at 2:31am

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