Forums

[Plugin: WP-PageNavi] getting pages with page/*/?junk everywhere (6 posts)

  1. TheWebHead
    Member
    Posted 2 years ago #

    basically anything with a page/#/?blahblah will not only display the page but if you have 1000s of pages like I do all the pagenavi links will show the same page/#/?blahblah format so you potentially have an infinite number of pages. I tried creating 301 redirects but for some reason the command is being ignored even trying to redirect a single URL w/o wildcards.

    http://wordpress.org/extend/plugins/wp-pagenavi/

  2. TheWebHead
    Member
    Posted 2 years ago #

    Okay to some degree I've solved my problem w/ the following:

    RewriteCond %{QUERY_STRING} ^referrer=.*$
    RewriteRule ^(.*)$ http://domain.com/$1? [R=301,L]

    But generally I'd like the ability to strip anything after /page/#/ but since search produces /page/#/s= I'm not sure there's an "anything but" directive. On the wordpress blog this issue can be replicated btw, just type ?whatever at the end of the paged URLs. Not only does the URL show the ?whatever at the end but the navigation links as well. It should be fixed at the software level rather than plugging holes with rewrite rules.

  3. scribu
    Member
    Posted 2 years ago #

    Could you provide a more specific example than page/#/?blahblah ?

    1. Steps to reproduce

    2. Expected behaviour

    3. Current behaviour

  4. TheWebHead
    Member
    Posted 2 years ago #

    Here's an example:

    http://wordpress.org/development/page/2/?info

    If you page down to the page bottom the newer/older post navigation links are:
    http://wordpress.org/development/?info
    http://wordpress.org/development/page/3/?info

    What results is a duplicate content and potential load issues if a search engine crawls a potentially infinite number of pages

  5. scribu
    Member
    Posted 2 years ago #

    This would be fixed if WordPress automatically stripped all unrecognized query arguments.

    However, it would also break a lot of plugins, since most don't register the query args they use.

  6. TheWebHead
    Member
    Posted 2 years ago #

    If anyone wants a guide to how to remove most of the impact of this issue, plug this into the .htaccess:

    RewriteCond %{QUERY_STRING} ^a.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^b.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^c.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^d.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^e.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^f.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^g.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^h.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^i.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^j.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^k.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^l.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^m.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^n.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^o.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^p.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^q.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^r.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^t.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^u.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^v.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^w.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^x.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^y.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^z.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^1.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^2.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^3.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^4.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^5.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^6.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^7.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^8.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^9.*$ [NC,OR]
    RewriteCond %{QUERY_STRING} ^0.*$ [NC]
    RewriteRule ^page/(.*)/?$ http://domain.com/page/$1/$2? [R=301,L]

    and you could add ^sa, ^sb, etc. to give some extra safeguards.

Topic Closed

This topic has been closed to new replies.

About this Topic