Using different codes in .htaccess file (Fail)

I moved my old site(www.mysite.com) to another location(blog.mysite.com). To keep worked my old URLs in Google, I added some codes in .htaccess like this:


RewriteCond %{HTTP_HOST} !^http://www\.mysite.com$ [NC]
RewriteRule ^categoryname/(.*)$ http://blog.mysite.com/categoryname/$1 [R=301,L]




But, when I add these codes in the Cs-Cart .htaccess file, they don't work. But, when I delete codes below,


RewriteCond %{REQUEST_FILENAME} !\.(png|gif|ico|swf|jpe?g|js|css)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php?sef_rewrite=1 [L,QSA]




the codes that I added work properly. But this time, when I do this, CS-CART SEO URLs fail, they don't work. So, I cannot delete them. I don't know what to do.



How can I add my extra codes in the .htaccess file?

So you want to move your store from 'www.yoursite.com' to a subdomain, 'shop.yoursite.com'. I'm really not sure with the .htaccess rules you have posted, unless you have changed your category URL structure and how you 'moved' the store, a much more simple .htaccess rule could be applied.



Did you just change the store paths in the config.local.php, or did you physically move the entire CS-Cart installation to a subdomain folder?



The following should do it, it sounds like you're placing your incorrect custom rules above the CS-Cart rules in your .htaccess file which is causing the CS-Cart specific rules to fall over.



RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.yoursite\.com$ [NC]
RewriteRule ^(.*)$ http://subdomain.yoursite.com/$1 [R=301,L]




This will redirect www.yoursite.com/category-name/ to 'subdomain.yoursite.com/category-name'



I always place custom htaccess rules in their own containers, like below, as it helps to remember what has been customised:


```php

DirectoryIndex index.html index.php



RewriteEngine on

Pleas note that RewriteBase setting is obsolete use it only in case you experience some problems with SEO addon.

Some hostings require RewriteBase to be uncommented

Example:

Your store url is http://www.yourcompany.com/store/cart

So “RewriteBase” should be:

RewriteBase /store/cart

RewriteBase /

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . index.php?sef_rewrite=1 [L,QSA]


These are your custom htaccess rules below



RewriteEngine on

RewriteCond %{HTTP_HOST} ^www.yoursite.com$ [NC]

RewriteRule ^(.*)$ http://subdomain.yoursite.com/$1 [R=301,L]



```