I have an issue in a Magento store that I can't quite figure out the solution for, so i was hoping for your assistance. There are 2 different store views each serving a different language. Those views are accessible by ULRs as the following:

base URL: www.example.nl

dutch version: www.exampe.nl/nl/cmspage

english version: www.example.nl/en/cmspage

The goal is to make the cms pages accessible only by using the correct country tag in the URL, this is working for the English part of the site but not for the Dutch.

To clarify:

www.exampe.nl/nl/cmspage is also accessible through www.exampe.nl/cmspage even when only nl is selected as storeview , the idea is to simply return a not found when trying to acces the cms page through www.example.nl/cmspage.

Any advice or tips you could give me on the subject would be greatly appreciated.

  • +1 as far as I know this is common behaviour for Magento. Maybee it should also be stated that a cms page is available with and without the language specifier (/nl in this case) only for the main storeview. All other storeviews don't have this issue/behaviour. I'm also looking for a solution.
    – Akif
    Apr 26, 2017 at 15:07
  • Can you please add config URL settings (and maybe edits in index.php - magerun_type ...) Solution should be here at least tonight ... we'll need this in near future, too :)
    – sv3n
    May 17, 2017 at 13:45
  • URL rewriting not working ? May 22, 2017 at 2:44
  • @Digitalmarketting do you mean "Use Web Server Rewrites = Yes"? This option is allready enabled.
    – Akif
    May 22, 2017 at 9:11
  • @sv3n index.php and magerun_type are default. The config URL settings are also default. Only thing is we use SSL for both front and backend. So unsecure url is with https.
    – Akif
    May 22, 2017 at 9:11

3 Answers 3


Please try this. It redirects every cms page w/o storecode in URL to the same page with storecode.


<?xml version="1.0" encoding="UTF-8"?>


public function test(Varien_Event_Observer $observer)
    $controller = $observer->getEvent()->getControllerAction();
    $request    = $controller->getRequest();
    $storeCode  = $request->getStoreCodeFromPath();

    $p = explode('/', trim($request->getRequestUri(), '/'));
    if ($storeCode != $p[0]) {
        $controller->getResponse()->setRedirect($request->getBaseUrl() . '/' . $storeCode . $request->getPathInfo());

Note: if i find a better solution, i'll update this post.

  • This is a good suggestion. I will try it out and report back. Is the code in the method tested?
    – Akif
    May 23, 2017 at 11:18
  • Yes, it's tested and took me some time :P
    – sv3n
    May 23, 2017 at 11:19
  • Works as expected +50. Also great to see it uses a 302 (moved) redirect. This is exactly what I was looking for. Thanks. Another thing; shouldn't this be in Magento core? At least as an option?
    – Akif
    May 23, 2017 at 13:44
  • A guess it will not be part of Magento core ... but i'll open a PR (with config option) here github.com/OpenMage/magento-lts
    – sv3n
    May 23, 2017 at 13:53
  • 1
    Opinion based ;) IMHO if i want to use storecodes in URL, they should alway be set. There are a lot of things that affect multistore users that should be fixed, e.g. storecode is unique so you can't set website1.com/en and website2.com/en, attribute settings are global, module config is global and many other things :(
    – sv3n
    May 23, 2017 at 14:02

I think this question has very easy solution.

Follow solution.

goto your cms page from your admin panel open it in edit mode

in a very first tab you will find store setting.

so select those store only for that you want to access that page and disable , and make remain others as unselected

  • Thanks, but same here. Unfortunately this is not the solution. The page is allready assigned to dutch (nl) storeview only. But is still is also accessible without /nl. So both www.exampe.nl/nl/cmspage and www.exampe.nl/cmspage are accessible.
    – Akif
    May 22, 2017 at 12:20

When creating cms page if you are selecting All Store Views the cms page will be available to all stores

so If you are using cms pages will be visible


In case you do want the selected cms page in nl then you just need to select en store for the selected cms page you want.

In that case the selected cms page will be visible only to english store

  • Thanks, but this is not the solution. The page has allready been assigned to dutch (nl) storeview only.But is still is also accessible without /nl. So both www.exampe.nl/nl/cmspage and www.exampe.nl/cmspage are accessible.
    – Akif
    May 22, 2017 at 12:19
  • Yes it may be available to both as both are redirected to same store I assume. So I am not able to understand are www.exampe.nl/nl/ and www.exampe.nl/ different stores ?
    – Priyank
    May 22, 2017 at 12:24
  • www.exampe.nl/ is just the base url. There are only 2 storeviews /nl and /en. The Dutch (/nl) version is the "main" storeview. Every CMS pages becomes availalbe on www.exampe.nl/nl/cmspage and www.exampe.nl/cmspage. This causes duplicate content. When I select a storeview the cms page should only be available for that storeview, and not also from base url. Does this make the problem clear?
    – Akif
    May 22, 2017 at 12:28
  • Since the base url is www.exampe.nl/ and your default store view is nl, so when you enter the base url without store code your default store view gets called which is nl so there is no duplication.
    – Priyank
    May 22, 2017 at 12:31
  • I don't think I made it clear then. Because there is duplicate content. One single CMS page is available to view from both www.exampe.nl/cmspage and www.exampe.nl/nl/cmspage. This is what I don't want. Does this make the problem clear?
    – Akif
    May 22, 2017 at 12:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.