httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Per Kofod <...@kofod.dk>
Subject [users@httpd] URL Rewriting goes into a infinite loop
Date Wed, 02 Oct 2002 15:55:22 GMT
Hi

Hope somebody can tell me how to avoid getting this loop

I would like to implement "sub domains", I can do it with php so
http://user.domain.com maps to http://domain.com/users/user; but
as this approach does not work with files e.g.
(http://user.domain.com/file.html
to http://domain.com/users/user/file.html) I am trying to do this using
URL rewriting.

I tried using the example:

+-----
| RewriteEngine on
| RewriteCond   %{HTTP_HOST}                 ^www\.[^.]+\.host\.com$
| RewriteRule   ^(.+)                        %{HTTP_HOST}$1          [C]
| RewriteRule   ^www\.([^.]+)\.host\.com(.*) /home/$1$2
+-----

Just as I cannot use www I modified so my rule looks like this:

+----
| RewriteEngine on
| RewriteBase   /
| RewriteCond   %{HTTP_HOST}                [^.]+\.per-kofod\.dk$
| RewriteRule   ^(.+)                       %{HTTP_HOST}          [C]
| RewriteRule   ([^.]+)\.per-kofod\.dk(.*)  /user/$1$2           [L]
+----

The problem is that the rewrite goes into a loop (see below), I first
tried implementing
this via .htaccess at my web hotel (running Apache/1.3.19), as it did
not work
I tried on my local PC with Apache/1.3.22 using the config file, and had
same result:

add path-info postfix: /var/www/html -> /var/www/html/
strip per-dir prefix: /var/www/html/ ->
applying pattern '^(.+)' to uri ''
pass through /var/www/html
strip per-dir prefix: /var/www/html/index.html -> index.html
applying pattern '^(.+)' to uri 'index.html'
RewriteCond: input='per.per-kofod.dk' pattern='[^.]+\.per-kofod\.dk$' =>
matched
rewrite index.html -> per.per-kofod.dk
add per-dir prefix: per.per-kofod.dk -> /var/www/html/per.per-kofod.dk
strip per-dir prefix: /var/www/html/per.per-kofod.dk -> per.per-kofod.dk
applying pattern '([^.]+)\.per-kofod\.dk(.*)' to uri 'per.per-kofod.dk'
rewrite per.per-kofod.dk -> /user/per
trying to replace prefix /var/www/html/ with /
internal redirect with /user/per [INTERNAL REDIRECT]
strip per-dir prefix: /var/www/html/user/per -> user/per
applying pattern '^(.+)' to uri 'user/per'
RewriteCond: input='per.per-kofod.dk' pattern='[^.]+\.per-kofod\.dk$' =>
matched
rewrite user/per -> per.per-kofod.dk
add per-dir prefix: per.per-kofod.dk -> /var/www/html/per.per-kofod.dk
strip per-dir prefix: /var/www/html/per.per-kofod.dk -> per.per-kofod.dk
--ETC--

---------------------------------------------------------------------
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


Mime
View raw message