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] [dot]com/404.php [R]
But that is a no go... Anyone?
Thanks
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
Share Improve this question edited Oct 12, 2016 at 16:51 Tom J Nowell♦ 61.2k7 gold badges79 silver badges148 bronze badges asked Oct 12, 2016 at 14:54 JADEComputerJADEComputer 214 bronze badges 3- 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 ♦ Commented Oct 12, 2016 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 ♦ Commented Oct 12, 2016 at 16:50
- Have you tried with the L flag, httpd.apache/docs/current/rewrite/flags.html#flag_l – Nabil Kadimi Commented Oct 12, 2016 at 21:11
2 Answers
Reset to default 1Thanks 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 ...
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.