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.

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

Custom urls


Go to End


4 Posts   1523 Views

Avatar
Kasheftin

Community Member, 3 Posts

6 September 2015 at 6:28am

I'm totally new in silverstripe. My friend asked to change urls of his site that's currently uses silverstripe cms. Now urls are long and ugly, for example:
apie-mus/komanda/TeamMember/agne-semberaite
There're some nested pages in admin panel, the first part depends on apie-mus (about) page, it has a child komanda (team) page, and there's a list of persons. As I understand, person has a TeamMember model.
The task is to overwrite urls totally to just a last part without TeamMember etc, so it should be just /agne-semberaite. Is it possible?
I understand that this url has not any infrormation about the dataset where it should perform a search for 'agne-semberaite'. So it should be like a oversearch through all collections.

Avatar
Bagzli

Community Member, 71 Posts

6 September 2015 at 6:42am

that depends on how you nest your pages in the admin panel. If you take a child page and put it out in the root it will not have the parent names. The nesting is also controlled with how you designed your system to begin with. If the child page has to be under parent then I'm not sure if you can do this.

For examples all newsArticles should be under news page. www.mysite.com/news/myarticle
I can create the page under root so its www.mysite.com/myarticle if my code allows it. I don't know what dependencies you have.

Avatar
Kasheftin

Community Member, 3 Posts

16 September 2015 at 12:00am

Ok, is it possible at least remove ClassName from links (they are in english now)?
apie-mus/komanda/TeamMember/agne-semberaite should convert to apie-mus/komanda/agne-semberaite;
/veikla/kurybiniai-uzsiemimai/Course/afrikietiska-perkusija should convert to /veikla/kurybiniai-uzsiemimai/afrikietiska-perkusija.

I can't broke tree-structure to a list without parents because top menu and some content based on it. I don't know the reason of this dependency, although.

Avatar
Kasheftin

Community Member, 3 Posts

16 September 2015 at 9:08am

Edited: 16/09/2015 9:10am

Are here any other people who bother about SEO or just uncomfortable sharing ugly long urls? I completed the task and now urls on the site are short and contain just the last part, URLSegment (there's error in case of doubles although). I didn't expect I should have written such rubbish code for this modern cms, but It happened - every 5 minutes it traverses all tables in database, collects URLSegment fields and creates cache with siteUrl<->myUrl compares. At the begining of framework/main.php it substitutes myUrl to $_GET'['url']'=siteUrl, and at the end - ob_get_contents and preg_replace all found urls back from siteUrl to myUrl.

I really hardly imagine that silverstripe does not have an option to add custom alias full url to any page.