JonP
JonP

Reputation: 29

Remove store code from URL in Magento

I have 2 sites on one Magento install that point to different domains.

Site1 => www.site1.com

Site2 => www.site2.com

Each site shows the store code in the url of category, product, and CMS pages (www.site1.com/store1/category). Is there a way to remove the /store1/ from the url so that is just www.site1.com/category? My guess is that can be done with .htaccess somehow.

Upvotes: 0

Views: 6553

Answers (3)

ICT Connection
ICT Connection

Reputation: 1

If you are on IIS 7 put the lines below in you web.config file Replace "nl" with your own storecode and "domain.com" with your domainname.

<rules>
    <rule name="301 remove storecode" stopProcessing="true">
        <match url="^nl/(.*)$" ignoreCase="true" />
        <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
            <add input="{HTTP_HOST}" pattern="www.domain.com" />
        </conditions>
        <action type="Redirect" url="http://www.domain.com/{R:1}" />
    </rule>
</rules>

Regards,

Upvotes: 0

dan.codes
dan.codes

Reputation: 3523

Since you have two different websites I don't think you need that anyway, I think there is a setting in system < config < web Add Store Code to Urls and you should try setting that to no and then reindex.

Upvotes: 2

jatt
jatt

Reputation: 398

TRY THIS .htaccess

Options +FollowSymLinks

RewriteEngine On
RewriteBase /

RewriteRule ^([A-Za-z0-9_]+)/category(-([0-9]+))? category.php?store=$1&id=$3 [L] 

Upvotes: -2

Related Questions