Paging URL rewriting not working in php using .htaccess -
i using rule in .htaccess :-
rewriterule ^online-sale on-sale.php rewriterule ^online-sale/page-([0-9]+)$ on-sales.php?page=$1
first rule working fine. eg. if phone call http://www.sitename/online-sale page opening successfully. when calling http://www.sitename/online-sale/page-2 page opening fine, can't access $_request["page"]
value on page.
can suggest me problem? possible or not?
thanks in advance.
you need utilize anchor $
in first rule avoid matching paging url well:
rewriterule ^online-sale/?$ on-sale.php [l] rewriterule ^online-sale/page-([0-9]+)/?$ on-sale.php?page=$1 [l,qsa]
it advisable utilize l
, qsa
flags.
qsa
(query string append) flag preserves existing query parameters while adding new one.
php .htaccess mod-rewrite redirect url-rewriting
No comments:
Post a Comment