301 Redirects Don't Work On Non-Seo Url's

I have an issue with 301 Redirect feature on new installation of current version CS-Cart - 4.3.1



I can't get any custom URL's from previous, old store which were non-seo friendly, like for example:



mysite/index.php?dispatch=categories.view&category_id=192



to be redirected to :



mysite/dancing-shoes



I have imported all the products and categories with SEO add-on enabled, and all the redirects were automatically created. Most of all redirects are actually pointing to itself, with the exception of few cases where I actually changed the category name or hierarchy / structure.



The mod_rewrite is enabled and functioning, the redirects actually happen if I type the previous version of the category name (but only as SEO enabled URL).



If I copy and paste in browser - mysite/shoes/dancing-shoes

it will get redirected to - mysite/dancing-shoes

without any problems, which means mod_rewrite is working



However, if I type mysite/index.php?dispatch=categories.view&category_id=192

which is the original URL for mysite/shoes/dancing-shoes

I get 404 page not found

even after I have created a new redirect from this URL



The old (non SEO URL's) are indexed by Google, and every single one of them is coming up as 404 error.



Does anyone know how to fix this problem? Has anyone tried to redirect non SEO URL's in CS-Cart ?

Any help will be appreciated.

Correction!!!



It seems that mod_rewrite is not enabled on server after all. I will contact the web hosting to clarify this first, then post an update.



Sorry.

hi,



you are on the right direction - it should be about mod_rewrite.



best regards,

WSA team

Back to the square one - there is a problem related to CS-Cart and perhaps htaccess file settings, as I have just tested “mod_rewrite” separately and it is installed and working.



What I have done is this:


  • created a subfolder within root directory called “rewrite_test”
  • created an htaccess file with following:

    RewriteEngine On

    RewriteRule ^google.html$ http://www.google.com/ [R=301]
  • loaded up mysite/rewrite_test/google.html in browser, and it det redirected to normal Google page.



    So somethiong is wrong, I don't know what or where to look for it.

    Please help, point me to where to look for solution.


[quote name='senadh' timestamp='1434118271' post='218555']

Correction!!!



It seems that mod_rewrite is not enabled on server after all. I will contact the web hosting to clarify this first, then post an update.



Sorry.

[/quote]

AN UPDATE!



I was able to establish that mod_rewrite is working without any doubt, so problem is elswhere.



There were lots of 301 redirects automatically created by SEO add-on, and they were all correct and working fine. I have changed few categories (some have been moved to the root, others have name changed) and all products affected have 301 redirects cretaed by add-on.



I was also able to create redirects manually, pointing one category to another, or even creating a redirect for fake URL and pointing to actiual category - like [color=#ff8c00]“/how-to-make-pancakes”[/color] is succesfully redirecting to actual category on website.



So, the mod_rewrite is working.



Where I am stuck and getting nowhere is when I try to redirect an old (non-SEO) URL such as:

[color=#ff0000]/index.php?dispatch=categories.view&category_id=192[/color]

to the new URL which is now

[color=#008000]mysite/some-category[/color]

  • it doesn't work!!!



    The redirect is being created and I can see it added to the list, but when I test the old URL I still get 404 error.



    I have tried putting in the old URL path without [color=#ff8c00]“index.php?”[/color] - like this:

    [color=#ff0000]/dispatch=categories.view&category_id=192[/color]

    and redirecting it to the new URL, and it worked. If I try to access the full URL in browser
  • [color=#008000]mysite/dispatch=categories.view&category_id=192[/color]

    it gets redirected to the new URL



    Why it doesn't work when “[color=#ff8c00]index.php?[/color]” is included, I simply don't know.



    Perhaps there is a bug in SEO add-on that needs to be fixed, or I am missing something. It could be that somewhere within rewrite conditions and rewrite rules something is not addressed as it should be.



    The htaccess part looks like this:



    [color=#8b4513]

    RewriteEngine on

Please 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 /

Options -MultiViews



RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]



RewriteCond %{REQUEST_URI} ^api/(.)$ [or]

RewriteCond %{REQUEST_URI} .
/api/(.)$

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule .api/(.)$ api.php?_d=$1 [L,QSA]



RewriteCond %{REQUEST_URI} .(png|gif|ico|swf|jpe?g|js|css|ttf|svg|eot|woff|yml|xml)$ [or]

RewriteCond %{REQUEST_URI} store_closed.html$

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.
?)/(.*)$ $2 [L]



RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . index.php [L,QSA]



[/color]



Any ideas? Anyone?

Do you think I should approach CS-Cart support team and submit a ticket?



Thanks in advance

I have tried putting in the old URL path without "index.php?" - like this:
/dispatch=categories.view&category_id=192
and redirecting it to the new URL, and it worked. If I try to access the full URL in browser
- mysite/dispatch=categories.view&category_id=192
it gets redirected to the new URL

Why it doesn't work when "index.php?" is included, I simply don't know.

Perhaps there is a bug in SEO add-on that needs to be fixed, or I am missing something. It could be that somewhere within rewrite conditions and rewrite rules something is not addressed as it should be.

The same problem. How to make redirect with non-SEO url like:

/index.php?dispatch=aff_banners.view&bid=1&sl=EN&aff_id=5

It works great without index.php?, but doesn't when index.php? included.