sitefinity-8

In sitefinity, How to prevent appending default Language prefix in page URLs?


In my sitefinity application, I need to remove default language prefix from sitefinity page URLs. Like in my case ar from https://www.example.net/ar/individual/products

So I did the following configuration change as mentioned in sitefinity documents:

1- Clicked Administration » Settings » Advanced.

2-In the treeview on the left, clicked Resources » UrlLocalizationStrategies » SubFolderUrlLocalizationStrategy » Parameters

3-In Key includeSubfoderPrefixForDefaultLanguage, entered False

4-Saved my changes and restarted the application.

But it did not work. Now, pages are still showing default culture prefix in Page URLs


Solution

  • You can try the following:

    navigate to Administration > Settings > Advanced > ContentView > Controls > FrontendPages > Views > FrontendPagesListView > View Modes > TreeTable > Columns > ViewColumn

    There, under Client Template you will see something like this:

    <a sys:href="{{ (PageLiveUrl) }}" target="_blank">View</a>
    

    From what I see, this PageLiveUrl is resolved by not taking the includeSubfolderPrefixForDefaultLanguage param into account. So, what you can do is to manually remove the language portion:

    <a sys:href="{{ (PageLiveUrl).replace('/en/', '/') }}" target="_blank">View</a>
    

    Save and refresh the page.