TIGblogs TIG | TIGblogs GROUP TIGBLOGS LOGIN SIGNUP
betzster's Blog
betzster's Blog
Forward to development dir, mod_rewrite

Let’s say you have a new web project you’re working on. Sure, you could setup a web server on your local machine and develop locally. For some reason you don’t want to do that though. Anyway, with this setup we’re going to assume you have some kind of landing page at the URL – why not? And you have a development directory dev. Now, as things get more complicated with this project, it would be nice if you could just point your browser at the root of the domain instead of a development directory. After all, eventually that’s where it’s going to live. Luckily, the solutions lies in .htaccess.

RewriteEngine on
RewriteCond %{REMOTE_ADDR} ^12.345.678.90
RewriteRule (.*) /dev/$1 [P,L]

Assuming your IP address is 12.345.678.90, this will forward the root of the domain to the /dev/ directory and your browser won’t know the difference. P means this is a proxy, so the URL won’t change. R would be a redirect which reloads the page at the URL – /dev/ in this case.

Since anyone could potentially spoof their REMOTE_ADDR, security is up to you.

Note: You’ll need mod_rewrite for apache installed for this to work.


June 25, 2011 | 6:06 AM Comments  0 comments

Tags:
You must be logged in to add tags.


Josh's Profile


Latest Posts
Network Favicons
Set up VirtualBox for...
Facebook Hackathon...
On Comments
WordPress &...

Monthly Archive
April 2007
May 2007
June 2007
July 2007
August 2007
September 2007
October 2007
November 2007
December 2007
March 2008
April 2008
May 2008
June 2008
July 2008
September 2008
October 2008
November 2008
December 2008
January 2009
February 2009
March 2009
April 2009
May 2009
June 2009
July 2009
August 2009
September 2009
October 2009
November 2009
December 2009
January 2010
February 2010
March 2010
April 2010
June 2010
July 2010
August 2010
September 2010
October 2010
November 2010
December 2010
January 2011
February 2011
March 2011
April 2011
June 2011
September 2011
October 2011
November 2011
December 2011
January 2012

Change Language


Tags Archive
apache asides band blog blogs coding design dreamweaver florida gallery general globalwarming hosting johnmayer network nifty php plugins politics prom publications school tech themes twitter vacation web windows wordpress youtube

Links
High School Reunion
Josh Betz Blog
Josh Betz Professional
Josh Betz Projects


28098 views
Important Disclaimer