
padonker at reporters
Jun 26, 2003, 10:26 AM
Post #19 of 51
(2982 views)
Permalink
|
Let me clearify my problem a bit I have a domain, say www.somesite.com, which is ip-forwarded to me. What I dont want is that whenever people connect to me ip-wise, they will end up on the somesite.com site. If one would connect to somesite.com, according to my access_log, a connection is made to my ip, referer somesite.com. If I connect to me on ip, referer would be the ip-number. I also have a dyndns.org account, which connects in a similair way. I know there is such a thing as VirtualDocumentRoot (not sure if it is called exactly like this), but that isnt fool-proof either. I prefer mod_rewrite as it is a more flexible solution which keeps possible future domain-names open. Hope this is helps you understand my problem a bit better P j.knowling [at] mgn wrote: >Hi Patrick, > >I'm not sure about the RewriteCond on %{DOCUMENT_ROOT} in your example, so >I'm not sure if I have missed the point of what you want to do, but >maybe... > >RewriteEngine On >RewriteCond %{HTTP_REFERER} ^http://([^/]+) >RewriteRule ^(.*)$ /server/%1/$1 [L] > >will do what you want. So you match the value of the referrer fromthe >"http://" up to the first slash in the RewriteCond, then in the >rewriteline, you rewrite the requested URI to /server/%1/$1 where %1 is the >value matched in the referrer ([^/]+) and $1 is the value matched by the >rewriterule ^(.*)$ - the uri requested from the browser. > >James. > > > >|---------+----------------------------> >| | Patrick Donker | >| | <padonker [at] report| >| | rs.net> | >| | | >| | 26/06/2003 00:44 | >| | Please respond to| >| | users | >| | | >|---------+----------------------------> > >------------------------------------------------------------------------------------------------------------------------------| > | | > | To: users [at] httpd | > | cc: | > | Subject: [users [at] http] Mod_Rewrite question | > >------------------------------------------------------------------------------------------------------------------------------| > > > > >Hi guys, > >1st of all, I'm a total newbe to both this mailinglist and mod_rewrite, >so pardon me if I'm asking this question while it has been asked a >zillion times before, or if it is the wrong place to ask it. >My problem is the following: > >I'd like to define a DocumentRoot based on the referer. So, if referer >would be http://www.somesite.com/, docroot should be >/server/www.somesite.com. If ref is http://192.168.0.100, then >/server/192.168.0.100. >My (non-functional) rule is: > >RewriteEngine on >RewriteCond %{HTTP_REFERER} !^http://www.somesite.com/$ [NC] >RewriteCond %(DOCUMENT_ROOT) !^/var/www/html$ >RewriteRule ^/$1 /server/www.somesite.com [R,L] > >Obviousely, this doesnt work...how DO I make it work??? >Thanks for any hints > >Patrick > > >--------------------------------------------------------------------- >The official User-To-User support forum of the Apache HTTP Server Project. >See <URL:http://httpd.apache.org/userslist.html> for more info. >To unsubscribe, e-mail: users-unsubscribe [at] httpd > " from the digest: users-digest-unsubscribe [at] httpd >For additional commands, e-mail: users-help [at] httpd > > > > > > > >******************** >IMPORTANT NOTICE This email (including any attachments) is meant only for the intended recipient. It may also contain confidential and privileged information. If you are not the intended recipient, any reliance on, use, disclosure, distribution or copying of this email or attachments is strictly prohibited. Please notify the sender immediately by email if you have received this message by mistake and delete the email and all attachments. > >Any views or opinions in this email are solely those of the author and do not necessarily represent those of Trinity Mirror PLC or its associated group companies (hereinafter referred to as "TM Group"). TM Group accept no liability for the content of this email, or for the consequences of any actions taken on the basis of the information provided, unless that information is subsequently confirmed in writing. Although every reasonable effort is made to keep its network free from viruses, TM Group accept no liability for any virus transmitted by this email or any attachments and the recipient should use up-to-date virus checking software. Email to or from this address may be subject to interception or monitoring for operational reasons or for lawful business practices. > >Trinity Mirror PLC is the parent company of the Trinity Mirror group of companies and is registered in England No 82548, with its address at One Canada Square, Canary Wharf, London E14 5AP. >******************** > >--------------------------------------------------------------------- >The official User-To-User support forum of the Apache HTTP Server Project. >See <URL:http://httpd.apache.org/userslist.html> for more info. >To unsubscribe, e-mail: users-unsubscribe [at] httpd > " from the digest: users-digest-unsubscribe [at] httpd >For additional commands, e-mail: users-help [at] httpd > > > > --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe [at] httpd " from the digest: users-digest-unsubscribe [at] httpd For additional commands, e-mail: users-help [at] httpd
|