[FX.php List] [Off] Help with .htaccess RewriteRule or Redirect

Troy Meyers tcmeyers at troymeyers.com
Fri Mar 21 14:15:15 MDT 2008


I've been looking at Apache's information about .htaccess and it's clear I'm over my head. I suspect someone here is a guru, so I'm asking...

The front page an all our images are hosted by a regular hosting ISP, Speakeasy. They use Apache and have told me I can use .htaccess files in my area of their server.

My domain name is troymeyers.com, and people going to either http://www.troymeyers.com or http://troymeyers.com end up on our default front page, which shows in their browser location box as http://www.troymeyers.com, I suppose but some sort of rewrite that Speakeasy enforces. But that's not an issue, it's fine. These front pages come out of the Speakeasy server.

We also have Speakeasy doing our DNS stuff, and the name "lab.troymeyers.com" is directed to our static IP here (instead of Speakeasy's server) at our physical location, and that's where the local FileMaker Server, WPE, and FileMaker-connected web server is. From the front page at Speakeasy, all deeper pages are hosted in this way by us, because all inner links are to some sort of http://lab.troymeyers.com/etc.

What I would like to do is be able to use URLs that don't have http://lab on the front be automatically redirected (either by Redirect or RewriteRule, whatever is most appropriate) if it is aimed at a certain directory.

Specifically, if someone uses a URL like this--
http://troymeyers.com/flasking/anyfilename.etc?etc
or
http://www.troymeyers.com/flasking/anyfilename.etc?etc

--their browser would be directed to:
http://lab.troymeyers.com/flasking/anyfilename.etc?etc

This is ONLY to occur if the directory /flasking/ is in the original URL.

The name lab.troymeyers.com refers to the server we have here, and Speakeasy's domain server already takes care of getting such queries here.

I was wondering if an .htaccess file or other method could be used --just for the "directory" /flasking/-- to get the user's machine automatically aimed here.

The idea is that if they don't get the prefix "lab." correct for any reason, they can still get where they want.

What would the .htaccess file contain, and would I put it in the root web directory for www.troymeyers.com, or would I create a /flasking/ directory in there and put the .htaccess file there?

I had thought I'd be able to figure this out myself, but in reading the instructional docs, I don't even know where to begin. I bet it's simple but I don't have a clue. Any help would be appreciated!

-Troy



More information about the FX.php_List mailing list