Url/path Redirect

admin

Administrator
Staff member
Some sites create dynamic urls, like perhaps <!--coloro:blue--><span style="color:blue"><!--/coloro--><u>http://www.foo.com/cow<!--colorc--></span><!--/colorc--></u> Where "cow" is not a file or a directory, but is redirected and the page is dynamically generated. I've looked in the usual places, but I can't figure out how this is done. If someone type's <!--coloro:blue--><span style="color:blue"><!--/coloro--><u>http://www.foo.com/cow<!--colorc--></span><!--/colorc--></u> , and I'm foo.com, how would I get that redirected to, say, <!--coloro:blue--><span style="color:blue"><!--/coloro--><u>http://www.foo.com/script.php?id=cow<!--colorc--></span><!--/colorc--></u> ? I think the answer lies in the .htaccess file, but I'm not sure.<br /><br />help?<!--content-->
Welcome to the forums zethon <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> <br /><br />You are correct, it's done in the .htaccess<br /><br />You can either do a single redirect<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->redirect 301 /cow http://www.foo.com/script.php?id=cow<!--c2--></div><!--ec2--><br /><br />or a general redirect (in this case, for all files except "elephant"<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->RewriteEngine on<br />RewriteBase   /<br /># don't rewite for elephant<br />RewriteCond %{REQUEST_URI} !^/elephant<br /># rewrite for eveything else ...<br />RewriteRule ^(.*) /script.php?id=$1 [L]<!--c2--></div><!--ec2--><!--content-->
 
Top