php - HTACCESS for given url -


i'm trying write rewriterule new url.


old url : https://www.ex.com/hindu-bbb-10/2

old htaccess:

rewritecond %{http_host} ex.com$ [nc] rewritecond %{request_uri} (bbb|ggg) rewriterule ^(.+?)/(.+?)(/?)$ seo/index.php?cat=$2&title=$1 [nc,l] 

by using above htaccess values request folllows

[cat] => 2 [title] => hindu-bbb-10 

i tried lot , 1 follows

new url : https://www.ex.com/hindu-bbb-10?pageno=2

new htaccess:

rewritecond %{http_host} ex.com$ [nc] rewritecond %{request_uri} (bbb|ggg) rewriterule ^(.+?)/(.+?)(.+?)$ seo/index.php?cat=$2?pageno=$1 [nc,l] 

and getting result [cat] => hindu-bbb-10

i can't values [cat] => 2 [title] => hindu-bbb-10 form old url.

how values [cat] => 2 [title] => hindu-bbb-10 using new url "https://www.ex.com/hindu-bbb-10?pageno=2"

for url https://www.ex.com/hindu-bbb-10?pageno=2

you need capture value query_string:

rewritecond %{http_host} ex.com$ [nc] rewritecond %{request_uri} (?:bbb|ggg) rewritecond %{query_string} ^pageno=(\d+) [nc] rewriterule ^([^/]+)/?$ seo/index.php?cat=%1&&title=$1 [nc,qsa,l] 

Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -