1

I have a strange request I thought would be simple. I need to break the Wordpress pagination. Specifically, I need to make the /page/2/, /page/3/, and so on, links disabled.

I tried:

RewriteRule ^page/[0-9] http://www.mysite[dot]com/404.php [R]

But that is a no go... Anyone?

Thanks

  • This should be possible entirely within PHP/WordPress using rewrite rules ( modification of rewrite rules ), enabling an answer that works via a plugin across Nginx and Apache, as well as others. HTAccess knowledge shouldn't be needed or necessary – Tom J Nowell Oct 12 '16 at 16:49
  • Also keep in mind that anybody can add the pagination query params manually to the end of the URL and continue using paging, it's not enough to disable the pretty URLs – Tom J Nowell Oct 12 '16 at 16:50
  • Have you tried with the L flag, httpd.apache.org/docs/current/rewrite/flags.html#flag_l – Nabil Kadimi Oct 12 '16 at 21:11
1

Thanks Nick! I thought that would work, and I placed it right after "RewriteEngine On" so it came first.

I did find a working solution for handling it though (after 2 hrs):

RewriteRule ^page/(.*)$ /$1 [G]

In case anyone else needs to do the same ...

|improve this answer|||||
0

That rule looks OK; the problem might be where you put it. Order matters in .htaccess, so be sure you're putting it in the right place. Check out this similar SO thread.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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