You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Richard Crawford <rc...@unexmail.ucdavis.edu> on 2004/09/01 18:11:39 UTC

[users@httpd] Rewriting a URL - kind of complicated

I want to make sure that all requests sent to my server are rewritten in 
a particular manner.  For example:

http://unexdlc.ucdavis.edu/DLC

should be

http://unexdlc.ucdavis.edu/cfmx/DLC

and

http://unexdlc.ucdavis.edu/DLC/folder1/file2

should be

http://unexdlc.ucdavis.edu/cfmx/DLC


However, if the page request comes from another page in our site, then 
the rewrite shouldn't happen.

Any idea how to pull that off?


-- 
Richard S. Crawford
Programmer III: Oracle/Solaris Wrangler
UC Davis Extension Distance Education Group (http://unexdlc.ucdavis.edu)
2901 K Street, Suite 200C
Sacramento, CA  95816
(916)327-7793



---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Virtualhost

Posted by "asiani@wanadoo.fr" <as...@wanadoo.fr>.
Hello,

I just want to say it is now ok !!
My problem was the domain and not my configuration

thanks,
Alain

creation of users with right for apache group
creation of subfolders
/home/domainA/www/html
...

httpd.conf

<Directory /home/*/www/html>
 Options Indexes FollowSymLinks
 <IfModule mod_access.c>
  Order allow,deny
  Allow from all
 </IfModule>
</Directory>

 Include conf/vhost.conf

----------------------------------------------------------
vhost.conf

NameVirtualHost *:80

<VirtualHost *:80>
    ServerAdmin root@free.fr
    DocumentRoot /home/domainA/www/html
    ServerName www.domainA.org
    ServerPath /domainA.org
    ErrorLog logs/domainA.org-error_log
    ServerAlias domainA.org
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin root@free.fr
    DocumentRoot /home/domainB/www/html
    ServerName www.domainB.com
    ServerPath /domainB.com
    ErrorLog logs/domainB.com-error_log
    ServerAlias domainB.com
</VirtualHost>




---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Rewriting a URL - kind of complicated

Posted by Robert Andersson <ro...@profundis.nu>.
Bruno Marcondes wrote:
> RewriteCond  %{HTTP_REFERER}   ! unexdlc.ucdavis.edu
> RewriteRule    /DLC/                          /cfmx/DLC   [L]
>
> RewriteCond  %{HTTP_REFERER}   ! unexdlc.ucdavis.edu
> RewriteRule    /DLC/(.+)/(.+)                    /cfmx/DLC   [L]

You must also decide whether or not the rules should be applied when there
is no Referer header; the above rules will rewrite the URL in those cases.

If there is no Referer header, it can be because of:
1) The client is configured to not send it, so the user might have
    clicked a link on your site.
2) The client is configured to not send it, so the user might have
    clicked a link on an external site.
3) The user typed in the URI directly.

There is no way of telling the above scenarios apart by looking at the
request. You can identify the first one by looking back in the logs, to see
if there has been a request from that IP.

Nitpicking, but the regex in those conditions should be escaped, eg.
"!unexdlc\.ucdavis\.edu".

Of course, there is no security in this either, since the Referer header is
easily spoofed.

Regards,
Robert Andersson


---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Rewriting a URL - kind of complicated

Posted by Bruno Marcondes <bm...@gmail.com>.
RewriteCond  %{HTTP_REFERER}   ! unexdlc.ucdavis.edu
RewriteRule    /DLC/                          /cfmx/DLC   [L]

RewriteCond  %{HTTP_REFERER}   ! unexdlc.ucdavis.edu
RewriteRule    /DLC/(.+)/(.+)                    /cfmx/DLC   [L]

I didnt test it , but something like this should do the work I guess !

[]'s 


On Wed, 01 Sep 2004 09:11:39 -0700, Richard Crawford
<rc...@unexmail.ucdavis.edu> wrote:
> I want to make sure that all requests sent to my server are rewritten in
> a particular manner.  For example:
> 
> http://unexdlc.ucdavis.edu/DLC
> 
> should be
> 
> http://unexdlc.ucdavis.edu/cfmx/DLC
> 
> and
> 
> http://unexdlc.ucdavis.edu/DLC/folder1/file2
> 
> should be
> 
> http://unexdlc.ucdavis.edu/cfmx/DLC
> 
> However, if the page request comes from another page in our site, then
> the rewrite shouldn't happen.
> 
> Any idea how to pull that off?
> 
> --
> Richard S. Crawford
> Programmer III: Oracle/Solaris Wrangler
> UC Davis Extension Distance Education Group (http://unexdlc.ucdavis.edu)
> 2901 K Street, Suite 200C
> Sacramento, CA  95816
> (916)327-7793
> 
> ---------------------------------------------------------------------
> 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@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 


-- 
"If you really want something in this life, you have to work for it.
Now, quiet! They're about to announce the lottery numbers..."
- Homer Simpson



On Wed, 01 Sep 2004 09:11:39 -0700, Richard Crawford
<rc...@unexmail.ucdavis.edu> wrote:
> I want to make sure that all requests sent to my server are rewritten in
> a particular manner.  For example:
> 
> http://unexdlc.ucdavis.edu/DLC
> 
> should be
> 
> http://unexdlc.ucdavis.edu/cfmx/DLC
> 
> and
> 
> http://unexdlc.ucdavis.edu/DLC/folder1/file2
> 
> should be
> 
> http://unexdlc.ucdavis.edu/cfmx/DLC
> 
> However, if the page request comes from another page in our site, then
> the rewrite shouldn't happen.
> 
> Any idea how to pull that off?
> 
> --
> Richard S. Crawford
> Programmer III: Oracle/Solaris Wrangler
> UC Davis Extension Distance Education Group (http://unexdlc.ucdavis.edu)
> 2901 K Street, Suite 200C
> Sacramento, CA  95816
> (916)327-7793
> 
> ---------------------------------------------------------------------
> 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@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 


-- 
"If you really want something in this life, you have to work for it.
Now, quiet! They're about to announce the lottery numbers..."
- Homer Simpson

---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org