0

I use friendly URLs on my wordpress page so I have for example shop/page/2 I would like to have It like shop/?paged=2. Is there anything like rewriterules but opossite to it ;) ? Which converts pretty permalinks into "ugly" one?

1

1 Answer 1

2

WP permalink handling is sort of layered. They underlying "ugly" permalinks capture the actual logic of the system and the "pretty" permalinks are just cosmetic enhancement on top of it.

Even when pretty permalinks are enabled, the original ugly permalinks still continue to work. But under normal circumstances they get redirected to a pretty version.

You could selectively kill pretty redirect with something like this:

add_filter( 'redirect_canonical', function ( $redirect_url ) {

    if ( is_paged() ) {
        return false;
    }

    return $redirect_url;
}, 10, 1 );

Though this won't affect how links are generated, so API functions which deal with pagination and stuff will still output pretty results. It's probably quite involved to override this comprehensively.

2
  • Thank you, so this makes me duplicate content, how to improve that ? Nov 29, 2016 at 13:06
  • Well, implemented properly it shouldn't be duplicate because it should redirect to one correct version of the page. If you do have duplicates they can and should be clarified with canonical tags.
    – Rarst
    Nov 29, 2016 at 13:38

Your Answer

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

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