jreinke / magento-hide-default-store-code

Hide default store code from URLs
26 stars 19 forks source link

404 error #9

Open RDXSportsCom opened 9 years ago

RDXSportsCom commented 9 years ago

i have 7 languages with code, and its showing me 404 on defaullt with default url

rossmc commented 9 years ago

@RDXSportsCom & @jreinke,

I'm having a similar issue, getting a 404 when I go to the default store view and the normal url behaviour when I select a different storeview.

Nothing in my exception.log either

SunshineTech commented 9 years ago

Modifying the Line 26 in Bubble_HideDefaultStoreCode_Model_Observer can solve it.

old code: $requestUri = $request->getServer('SCRIPT_NAME') . '/' . $storeCode . '/' . $requestUri;

new code: $requestUri = '/' . $storeCode . '/' . $requestUri;

16hands commented 9 years ago

@SunshineTech's fix worked for a site we've been working on also, its a great module for retro fitting multi-store into an existing magento setup

Thanks for the fix

altafhussain10 commented 8 years ago

Not working for me in Magento 1.9.2. Still get 404 page :( and also a too many redirects error

liuggio commented 8 years ago

@SunshineTech great catch!

liuggio commented 8 years ago

@jreinke please accept PR

liuggio commented 8 years ago

We have fixed in this way


<?php

    public function onFrontInitBefore(Varien_Event_Observer $observer)
     // ... 

            $hasGotScriptName = strpos($requestUri, $request->getServer('SCRIPT_NAME'));

      // ...
                    $prefixScriptName = "";
                    if ($hasGotScriptName !== false) {
                      $prefixScriptName =  '/' .trim($request->getServer('SCRIPT_NAME'), '/');
                    }

                    $requestUri = $prefixScriptName.'/' . $storeCode . '/' . $requestUri;