[FX.php List] [Off] Help with .htaccess RewriteRule or Redirect
Troy Meyers
tcmeyers at troymeyers.com
Fri Mar 21 17:03:02 MDT 2008
Roger,
That's just the sort of thing I was expecting, and yes, that was my expectation because of similar things used with Blackbelt.
Basically I want to catch every instance of:
http://www.troymeyers.com/flasking/whateverelse
and turn it into
http://lab.troymeyers.com/flasking/whateverelse
...and only do it for "flasking" obviously.
Thus--
http://www.troymeyers.com/flasking/priceincrease.php?a=FRHDRE
would become:
http://lab.troymeyers.com/flasking/priceincrease.php?a=FRHDRE
AND
http://www.troymeyers.com/flasking/upload.php
would become:
http://lab.troymeyers.com/flasking/upload.php
BUT
http://www.troymeyers.com/cultivars/4343fc.jpg
would be unchanged.
>From my experiences with Blackbelt I was sort of expecting a $ to be somewhere in the RewriteRule, but as I said I don't understand the syntax.
I don't think protecting against doing something to a URL already starting with lab. would be an issue, since that sort of URL would never come to Speakeasy's server, but to my in-house one instead.
But that may be a problem with .htaccess, maybe it only works _within_ a server?
-Troy
> Wouldn't this be very similar to what is in the .htaccess file that
> controls how BlackBelt runs?
>
> I can't help with the syntax as I'm hopeless at regular expressions,
> but I have this line in one of my Virtual Hosts listings
>
> RewriteEngine On
>
> RewriteRule /Genealogy/.* http://genealogy.clanmoffat.org/ [R]
>
> and it works to take any request that included
>
> /Genealogy/anthingAfterTheSlash
>
> and redirect it to
>
> http://genealogy.clanmoffat.org/
>
> I see no reason why the same two lines in a .htaccess file wouldn't
> work - just figure out what it is you need to say on each side of the
> [space] there in that RewriteRule
>
> but it seems like you're looking for something like
>
> RewriteRule .*/flasking/.* http://lab.troymeyers.com/flasking/whatever
>
> As I say I know nothing about the syntax of how to parse out what you
> want (and to stop the rewrite if they've already arrived at
> lab.troymeyers.com/flasking/whatever but from what I've learned in
> other places I use Apache you should be able to accomplish what you
> want in a .htaccess file with the correct regular expression.
>
> Roger
More information about the FX.php_List
mailing list