2

I want to create pagination on my Category pages. I have added this too the footer and configured it via the config and it shows up as expected.

Pagination

Looks great at first sight, however when I select a different page, for example the 4th page. I get redirected to a link like. https://www.example.com/en/mycategory/where/p/4/

This page gives a 404 error. https://www.example.com/en/category4?p=4

Works fine, I can't seem to be able to change the URL structure anywhere. The first idea which comes to mind is to use htaccess rewrites. But this will get nasty very soon if I am also going to add filters.

Which generate links such as https://www.example.com/en/mycategory/where/dir/asc/order/price/

And changing the amount of products per page generate a link like https://www.example.com/en/mycategory/where/limit/30/ Which all give 404 errors.

This will become a mess to do via htaccess if I ever want to make these combinable.

What place should I look to figure out the URL structure, or where should I activate to accept this url structure? (I prefer to be able to change it because this looks like bad SEO)

Since categories can have subcategories, a link can also have more subdivision before the "/where/" making htaccess even worse. URL: https://example.com/en/mycategory/mysubcategory/where/p/5

Edit: I tried the following htaccess code, which is supposed to be recursive, but I get 500 internal server errrors.

Turn the slashed URL into query strings

RewriteRule ^(.*)/where/([^/]*)/([^/]*)(/.*)?$ $1/where/$4?$2=$3 [L,QSA,R=301]

Remove the "/where/" from the url

RewriteRule ^(.*)/where/?$ $1 [L,QSA,R=301]

(I'd prefer a 301 redirect because of SEO reasons, don't want my pagerank splitting up.)

3
  • do you have any seo related extension that affects the filtering and paging. Normally the paging should return urls with ?p=4 not /p/4.
    – Marius
    Commented Mar 21, 2016 at 14:56
  • I have some old ManaPro extensions which used to do that. They messed up filtering links indeed. I deactivated them (uninstalling them crashed the site), so weird that they would still affect URL rewrites. Feels like those old crappy modules are still being called here and there. However I think it might be easier to use the htaccess approach since I am not fully aware of all the modules functions in this installation since I am not the original developer. Commented Mar 21, 2016 at 15:18
  • Seems like my htaccess code is correct. Just had to remove the space before the R=301 Commented Mar 22, 2016 at 8:36

1 Answer 1

0

Seems like my htaccess code is correct. Just had to remove the space before the R=301

Turn the slashed URL into query strings

RewriteRule ^(.*)/where/([^/]*)/([^/]*)(/.*)?$ $1/where/$4?$2=$3 [L,QSA,R=301]

Remove the "/where/" from the url

RewriteRule ^(.*)/where/?$ $1 [L,QSA,R=301]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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