.htaccess - htaccess redirect search specific query strings and remove -


i redirect list of 404 pages www.domain.com/news/ seo reason.

i redirect pages www.domain.com/news/?p=1234 , www.domain.com/news/?p=111&replytocom=333 code:

rewritecond %{query_string} ^(p=1234|p=111)($|&)  rewriterule ^news/$ domain.com/news/ [l,r=301] 

but of these pages have strange query strings , don't know how query them , remove them in htaccess.

www.domain.com/news/?p=12345;0;0;0;latestnews www.domain.com/news/?feed=rss&p=123 www.domain.com/news/?p=123%3b0%3blatestnews 

i don't want redirect url wth /?p= /news/ because of them redirect specific page.

thanks lot in advance.


ok came solution these two

www.domain.com/news/?p=12345;0;0;0;latestnews www.domain.com/news/?p=123%3b0%3blatestnews 

i add p=123;0;0;0latestnews in condition code write ths

rewritecond %{query_string} ^(p=1234|p=111|p=123;0;0;0latestnews)($|&)  

and working!

still searching way deal

www.domain.com/news/?feed=rss&p=123 

if have solution please tell me! lot!


i found answer feed=rss&p=123, sorry forgot metion site wordpress site.

so seems browser not recognise page 404 or page under our server. page looks empty rss page. decide disable rss since don't use it, redirect via php. code in functions.php

function wp_disable_feed() {      header('location: http://www.mysite.com/news/');     //wp_die( __('sorry, no feeds available, return <a href="'. get_bloginfo('url') .'">homepage</a>') ); } add_action('do_feed', 'wp_disable_feed', 1); add_action('do_feed_rdf', 'wp_disable_feed', 1); add_action('do_feed_rss', 'wp_disable_feed', 1); add_action('do_feed_rss2', 'wp_disable_feed', 1); add_action('do_feed_atom', 'wp_disable_feed', 1); 

why don't try :

rewritecond %{query_string} ^(p=1234|p=111|p=123;0;0;0latestnews|feed=rss&p=123) rewriterule ^news/$ http://domain.com/news/ [r=301] 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -