How To Use Mod_rewrite To Redirect Users?

liunx

Guest
Hi. I'm trying to use mod_rewrite to refer any URLs with my domain to a Weblog hosted by Typepad.<br /><br />In other words, when people come to <!-- w --><a class="postlink" href="http://www.myTCHdomain.com/blog/content.htm">www.myTCHdomain.com/blog/content.htm</a><!-- w --> I want the page that loads to be <a href="http://myblogname.typepad.com/blog/content.htm" target="_blank">http://myblogname.typepad.com/blog/content.htm</a> but the URL in the browser to remain <!-- w --><a class="postlink" href="http://www.myTCHdomain.com/blog/content.htm">www.myTCHdomain.com/blog/content.htm</a><!-- w --> <br /><br />I'm using this code in my .htaccess file:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->RewriteEngine on<br />RewriteRule ^blog/(.*)$ http://myblogname.typepad.com/blog/$1 [P]<br />RewriteRule ^blog$ http://myblogname.typepad.com/blog/ [P]<br />RewriteRule ^/$ http://myblogname.typepad.com/ [P]<br />RewriteRule ^$ http://myblogname.typepad.com/ [P]<!--c2--></div><!--ec2--><br /><br />which I'm told has worked for other people using Typepad, but after I upload that, I keep getting this error when going to my domain on TCH:<br />"Not Found. The requested URL / was not found on this server."<br /><br />I can't figure out what I'm doing wrong and was wondering if you might have any ideas. I don't really know how to use mod_rewrite -- I'm just borrowing others' code -- so I'm not sure if there's something I need to change to make it work with TCH.<br /><br />Thanks.<!--content-->
This may or may not be related (as i'm not too sharp with mod_rewrite), but is mod_proxy installed on our servers (mine is 50)? I was trying to get this to work too, and it seems the "[P]" sends the request through mod_proxy. I could be way off here... <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/huh.gif" style="vertical-align:middle" emoid=":huh:" border="0" alt="huh.gif" /><!--content-->
No. Krieser is exactly right. Proxying is not enabled. [P] is telling the redirects to use mod_proxy.<br /><br />The rewrite rules you have are correct if proxy was installed.<br /><br />Since allowing proxy through a hosting provider's servers can open up some opportunities of abuse, I'm not sure that's something TCH would allow, but if you want mod_proxy installed, you'll likely have to open up a support ticket and see if they'll approve it.<!--content-->
 
Back
Top