Welcome to WebmasterWorld Guest from 54.145.13.215

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Conditional .htaccess?

     
3:15 pm on Aug 16, 2011 (gmt 0)

Preferred Member

10+ Year Member

joined:July 13, 2005
posts: 418
votes: 0


Just wondering if there is a way to switch between htaccess rules depending on the url? In this scenario, I want to switch between rules depending if I'm on my localhost or live server?

For ages now I've just been renaming the .htaccess files - but is there an easier way?
6:55 pm on Aug 16, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


Set the configuration in the localhost site to use a different filename, one other than .htaccess and you can then be sure to never accidentally overwrite a file with the wrong version.
7:36 pm on Aug 16, 2011 (gmt 0)

Preferred Member

10+ Year Member

joined:July 13, 2005
posts: 418
votes: 0


Which has happened.

Could you please be a little more specific, I'm not sure what you mean by 'configuration' - httpd.conf?
8:52 am on Aug 17, 2011 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10544
votes: 8


you can configure the name of the distributed configuration file per virtual host in httpd.conf using the AccessFileName Directive:
http://httpd.apache.org/docs/current/mod/core.html#accessfilename