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

How to change URL Segment after duplicate has been rectified?


Go to End


8 Posts   849 Views

Avatar
Turismo

Community Member, 28 Posts

20 May 2016 at 2:29am

I went to change a URL Segment, and it appended -2; I then realised this was because I had another page sharing an identical URL Segment. I changed this 2nd page URL Segment, and I've now gone back to change the first instance to what I originally intended, but -2 is still being appended.

I can't see any other pages using this URL Segment anymore, so why is it still forcing -2?

Avatar
martimiz

Forum Moderator, 1391 Posts

21 May 2016 at 3:15am

I've tried but I cannot reproduce this - if I change the name of the 'other' page (and publish it) then I can remove the -2 just fine. This is in v3.3...

Avatar
Vlad Belfort

Community Member, 55 Posts

21 May 2016 at 3:27am

I've also got this issue. I'm running v3.2

I tried searching around the URLSegment column in a bunch of tables like SiteTree, SiteTree_versions etc for the URL without a '-2' to see if there's something that's already taken it but couldn't find anything...

sub'd to this

Avatar
Turismo

Community Member, 28 Posts

21 May 2016 at 3:47am

Checked SiteTree (normal, _live and _versions) and I can't see any URL Segments as 'project', but when I try to change a page to 'project' in the CMS it forces 'project-2'. I'm on version 3.3.2.

Avatar
martimiz

Forum Moderator, 1391 Posts

21 May 2016 at 4:32am

Felt like maybe I didn't test this thouroughly enough, so just to make sure I did this:

- installed a brand new version of SilverStripe
- renamed 'contact' urlsegment to 'project' and published
- renamed 'about-us' urlsegment to 'project'. Came out as 'project-2'. Published
- went back and changed urlsegment 'project' to 'project-altered' and published
- went back again and changed urlsegment 'project-2' to 'project' and published.

went just fine... So maybe it's only in special circumstances? Or because of some module? Or?

Avatar
Turismo

Community Member, 28 Posts

23 May 2016 at 8:18am

Hey martimiz,

Thanks for taking the time to investigate this further, and trial it your side.

I double checked for any duplicates in phpMyAdmin, by running these three SQL queries:

SELECT * FROM `SiteTree` WHERE `URLSegment` = 'project'
SELECT * FROM `SiteTree_live` WHERE `URLSegment` = 'project'
SELECT * FROM `SiteTree_versions` WHERE `URLSegment` = 'project'

No results for returned for the above, and tried again via the CMS and '-2' was still appended.

So I decided to just change it directly in the phpMyAdmin for SiteTree, SiteTree_live and SiteTree_versions. I then tried to navigate to the page in the front-end, and very interestingly I get a white screen with this error:

Action 'project' isn't allowed on this handler.

Do this shed anymore light on the possible cause? Is 'project' not allowed as a URLSegment in SS for some reason?

Avatar
martimiz

Forum Moderator, 1391 Posts

23 May 2016 at 9:38am

Edited: 23/05/2016 9:39am

Hmm so it is't recognized as an URLSegment, so Silverstripe is trying to open it as an action on the parent, which in this case doesn't work, obviously...

I have no idea where this would come from... Have you tried to reproduce it with a totally different URLSegment? You don't by chance have a controller called Project? Maybe you could check this with a new SilverStripe install as well? Just to make sure it isn't something in your code, or some module? Just guessing here :)

Avatar
Turismo

Community Member, 28 Posts

23 May 2016 at 9:54am

Hey martimiz,

Installed a brand new SS project, and gone to create a new Page called 'Project' under 'About Us', and it still forces the -2 - very, very weird.