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

SS 3.0 Problem with URLSegments and dots (worked in 2.4)


Go to End


816 Views

Avatar
th3hamm0r

Community Member, 2 Posts

8 September 2012 at 11:39pm

Edited: 08/09/2012 11:40pm

hi,

I'm currently facing a problem with dots in urlsegments what worked with silverstripe 2.4.X but doesn't with 3.X.

I have pages which have dots in their title field and in silverstripe 2.4.X they automatically got converted into dashes. In 3.X dots remain in the generated url segment.
But now I cannot open the page in the frontend since the last part after a dot is handled as an extension and the remaining part is not found in the list of urlsegments.
For example the title "A Cool.company.name" is translated into the urlsegment "a-cool.company.name" and each request to this urlsegment is splitted into "a-cool.company" as the url and "name" as the extension.
Is this a feature? :)

I found the responsible code:
In 2.4 the generateURLSegment method in the SiteTree class has the following code to replace dots with dashes:

ereg_replace('[^A-Za-z0-9]+','-',$t);

In ss 3 the introduced URLSegmentFilter instead uses this expression which leaves all dots:

/[^A-Za-z0-9+.-]+/u

Of course, now I could replace the default replacements in this URLSegmentFilter with the old one, but I would like to know why dots are now permitted and therefore are now causing problems with dots in titles.

I hope I chose the right forum(?)

thank you

stefan