I want to know RewriteRule to convert
http://localhost/wmylo/baby-names/boy/starting-with-a/?pageno=2
to
http://localhost/wmylo/baby-names/boy/starting-with-a/page/2
I have activated mod_rewrite in localhost. I used the following steps for it(in httpd.conf file):
- Removed # in front of
#LoadModule rewrite_module libexec/apache2/mod_rewrite.so - Changed all AllowOverride None to AllowOverride All
- Searched word php in file and remove # in front of lines with php word.
I tested it, and the following RewriteRule works to add "www" in front of all web links linked to WordPress website(in .htaccess file):
RewriteCond %{HTTP_HOST} !^www. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
I have tried to make my own RewriteRules to get '/page/2' in the end of link:
RewriteCond %{QUERY_STRING} (^|&)pageno=2($|&) RewriteRule ^wmylo/baby-names/boy/starting-with-a/$ /wmylo/baby-names/boy/starting-with-a/page/2?&%{QUERY_STRING}RewriteRule page/(.).html ?pageno=$1RewriteRule /pageno/(.*)/ ?pageno=$1RewriteRule ^starting-with-a/page/([0-9]+)?$ /starting-with-a/?pageno=$1 [L]I have also tried to add following code in functions.php
function custom_rewrite_basic() { add_rewrite_rule('^page/([0-9]+)/?', '?pageno=$matches[1]', 'top'); } add_action('init', 'custom_rewrite_basic');Also tried 'rewrite' plugin however it is not tested with current version of Wordpress and didn't work as per requirement.
All of the above RewriteRules aim to get the desired output given above. None are working.
How can I create the RewriteRule to achieve my desired output?
Page numbers will change for pagination on table.