regex - Updated rewrite rule in htaccess, getting error 404 in google web master tools -


i changed 1 of rewrite rule new structure , i'm notice error 404 in google web master tools of pages.

old rewrite rule:

rewriterule ^channel.([a-za-z0-9-_]+)-([a-z]+)$ channel.php?user=$1&q=$2 

new rewrite rule:

rewriterule ^channel:([a-za-z0-9-_]+)$ channel.php?user=$1 [l] 

now i'm getting lot of error 404 pages old rewrite rule. got custom 404 page , correctly return header not found, google still report me errors. how can fix it? sorry bad english, need fix this...

not sure before , after effect regex incorrect have unescaped hyphen in middle. hyphen needs @ 1st or last position avoid escaping in character class.

use rule:

rewriterule ^channel.([\w-]+)-([a-z]+)$ channel.php?user=$1&q=$2 [l,qsa] 

or:

rewriterule ^channel:([\w-]+)$ channel.php?user=$1 [l,qsa] 

it better know urls you're trying match using these rules.

edit: per comments use rule block old urls:

rewritecond %{the_request} \s/+channel\. [nc] rewriterule ^channel\.([^-]+) /channel:$1 [l,r=301,nc] 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -