I want to redirect a dynamic url which looks like, www.example.com/?subaction=showfull&year=2009&month=03&day=06&news_name=example-post Code (markup): to the static one i.e. www.example.com/2009/03/06/example-post.html Code (markup): how can i do that plz specify a .htaccess code for that
RewriteEngine On RewriteRule ^?subaction=showfull&year=([0-9]+)&month=([0-9]+)&day=([0-9]+)&news_name=([a-z0-9_-]+)$ /$1/$2/$3/$4.html Code (markup):
RewriteEngine On RewriteRule ^\/([0-9]+)\/([0-9]+)\/([0-9]+)\/([a-z0-9_-]+)\.html$ ?subaction=showfull&year=$1&month=$2&day=$3&news_name=$4) Code (markup):
ok i just make you clear the following code is already in my .htaccess but anyhow google has indexed the dynamic URL and that could penalize me because static and dynamic both are giving the same content.so i want to redirect the dynamic one to static URL which is already configured to convert in dynamic but in serverside.
You will need a RewriteRule with [R=301,L] flags for this, not a redirect. redirect cannot see Query Strings. You'll need a RewriteCond to test the QUERY_STRING too. Do not mix RewriteRule and redirect here. Use RewriteRule for all of the rules. As this is one of the most requested topics here (almost every day it seems), there are a very large number of prior examples to browse.