1

When I click on category from homepage I found my URL format like this example.com/en/category.

I need to remove the /en from URL.

enter image description here

3 Answers 3

0

Add Preference to <Vendor>/<Module>/etc/di.xml:

<preference for="Magento\Store\Model\Store" type="<Vendor>\<Module>\Model\Store" />

than override the following protected function.

protected function _updatePathUseStoreView($url)
{
    if ($this->isUseStoreInUrl()) {
        $url .= $this->getCode() . '/';
    }
    return $url;
}

with below code:

protected function _updatePathUseStoreView($url)
{
    if ($this->isUseStoreInUrl()) {
        if($this->getCode() == 'default'){
            $url .= '/';
        }else{
            $url .= $this->getCode() . '/';
        }

    }
    return $url;
}
0

Set: Store -> Configurations -> General -> Web -> Url Options -> Add Store Code to Urls to 'No'

Note: Please make sure you are not running multi-website multi-store structure using this setting as it may stopped working after changing it.

0

When we set up a Magento store, it will pick the default Title and Meta Description and we need to edit these to optimize for SEO. So first Navigate to Magento 2

admin >> Content >> Design >> Configuration >> URL option Set to No

enter image description here

For more reference Click here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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