.htaccess - Redirect htaccess php -


i want redirect page htaccess

products_filter.php?f16%5b0%5d=bla+bla+bla&cpath=72&m_id=12x 

to

products_filter.php?f16%5b0%5d=bla+bla&cpath=72&m_id=12x 

i tried (and many other ways)

rewritecond %{query_string} ^f16%5b0%5d=bla+bla+bla$ rewriterule ^products_filter\.php$ http://www.example.com/products_filter.php?f16%5b0%5d=bla+bla&cpath=72&m_id=12x [l,r=301]  

what doing wrong here?

problem using $ (end of input) in regex:

rewritecond %{query_string} ^f16%5b0%5d=bla+bla+bla$ 

since query string is: 16%5b0%5d=bla+bla+bla&cpath=72&m_id=12x

change line to:

rewritecond %{query_string} ^f16%5b0%5d=bla+bla+bla(&|$) 

update:

looking @ question realize using quite few special characters need escaped.

rewritecond %{query_string} ^(f16%5b0%5d)=bla\+bla\+bla(?:&(.*)|$) [nc] rewriterule ^(products_filter\.php)$ /$1?%1=bla+bla&%2 [l,r=301,ne]  

ps: important use ne flag here. otherwise %5b , %5d further encoded apache.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -