Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RewriteCond for switching directories

Status
Not open for further replies.

tewari68

Programmer
Jan 25, 2005
87
US
Hi,
I have a apache setup where there is one apache server in the DMZ which acts as a proxy and proxies all requests to the servers inside the firewall.
Now depending on the HTTP_REFERER I want to server the pages from different directories for ex.
if http_referer is is proxied to the downstream server and the documents are served from /a/b/c/d directory.
whereas if the referer is I want to switch the directory to /e/f/g/h, this way I can server different pages for the same url, depending on the referer value.
One site will be a preview site where authors can preview before actually publishing to the production site.
I have the following rule in place however this does not work, appreciate any help for this issue

RewriteCond %{HTTP_REFERER} ^/ [NC]
RewriteRule ^/X/(.*) ^/a/b/c/d/$1 [L]

RewriteCond %{HTTP_REFERER} ^/ [NC]
RewriteRule ^/X/(.*) ^/e/f/g/h/$1 [L]

Thanks,
Mohit
 
Not sure if this helps but is the rewrite rules from an Apache virtualHost for rewriting into a users home web ....

It may just give some clues:

Code:
RewriteEngine on
RewriteCond %{HTTP_HOST}                !^123.132.12.123(:80)?$
RewriteCond %{HTTP_HOST}                !^[URL unfurl="true"]www.testme.co.uk(:80)?$[/URL]
RewriteRule ^/(.*)                      [URL unfurl="true"]http://www.testme.co.uk/$1[/URL] [L,R]
RewriteOptions inherit
AliasMatch ^/~([^/]+)(/(.*))? /home/sites/site13/users/$1/web/$3
AliasMatch ^/users/([^/]+)(/(.*))? /home/sites/site13/users/$1/web/$3

I hope it helps

Laurie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top