httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yves Goergen <nospam.l...@unclassified.de>
Subject Re: [users@httpd] mod_rewrite problem
Date Sun, 05 Aug 2007 10:04:30 GMT
On 04.08.2007 18:25 CE(S)T, Joshua Slive wrote:
> Once you know that you need to use mod_rewite, there is no point in
> fooling around with mod_setenvif. It is simpler to do everything in
> mod_rewrite. Or avoid it entirely.

My point with SetEnv[If] was to only enter the hostname once and not in
every single rule.

> Try one of the solutions here:
> http://wiki.apache.org/httpd/CanonicalHostNames

I can't use the Redirect directive because it only works good inside a
<VirtualHost> section which I can't use. The mod_rewirte thing doesn't
work with the same problem like I already have.

> Also note that you should not do rewriting in .htaccess unless you
> really have to. And if you still use mod_rewrite and can't get it to
> work, then use the RewriteLog to see what is going on.

Yes, I need to. What I do here is ensuring my website is visible from a
single domain only. This is a configuration that belongs to my website
specifically, not the entire server which (despite being under my
control) is shared with many other users that like different configuration.

I now managed to use RewriteLog on the server. Here's the results:

    http://unclassified.de/beta
    -> http://beta.unclassified.de//www/web002/beta

> 84.148.53.163 - - [05/Aug/2007:11:58:22 +0200] [unclassified.de/sid#8336258][rid#8444c98/initial]
(3) [per-dir /www/web002/beta/] applying pattern '^(.*)' to uri '/www/web002/beta'
> 84.148.53.163 - - [05/Aug/2007:11:58:22 +0200] [unclassified.de/sid#8336258][rid#8444c98/initial]
(4) RewriteCond: input='beta.unclassified.de' pattern='!^$' => matched
> 84.148.53.163 - - [05/Aug/2007:11:58:22 +0200] [unclassified.de/sid#8336258][rid#8444c98/initial]
(2) [per-dir /www/web002/beta/] rewrite /www/web002/beta -> http://beta.unclassified.de//www/web002/beta
> 84.148.53.163 - - [05/Aug/2007:11:58:22 +0200] [unclassified.de/sid#8336258][rid#8444c98/initial]
(2) [per-dir /www/web002/beta/] explicitly forcing redirect with http://beta.unclassified.de//www/web002/beta
> 84.148.53.163 - - [05/Aug/2007:11:58:22 +0200] [unclassified.de/sid#8336258][rid#8444c98/initial]
(1) [per-dir /www/web002/beta/] escaping http://beta.unclassified.de//www/web002/beta for
redirect
> 84.148.53.163 - - [05/Aug/2007:11:58:22 +0200] [unclassified.de/sid#8336258][rid#8444c98/initial]
(1) [per-dir /www/web002/beta/] redirect to http://beta.unclassified.de//www/web002/beta [REDIRECT/301]

    http://unclassified.de/beta/      (notice the trailing slash)
    -> http://beta.unclassified.de/

> 84.148.53.163 - - [05/Aug/2007:11:59:25 +0200] [unclassified.de/sid#8336258][rid#8481f88/initial]
(3) [per-dir /www/web002/beta/] strip per-dir prefix: /www/web002/beta/ ->
> 84.148.53.163 - - [05/Aug/2007:11:59:25 +0200] [unclassified.de/sid#8336258][rid#8481f88/initial]
(3) [per-dir /www/web002/beta/] applying pattern '^(.*)' to uri ''
> 84.148.53.163 - - [05/Aug/2007:11:59:25 +0200] [unclassified.de/sid#8336258][rid#8481f88/initial]
(4) RewriteCond: input='beta.unclassified.de' pattern='!^$' => matched
> 84.148.53.163 - - [05/Aug/2007:11:59:25 +0200] [unclassified.de/sid#8336258][rid#8481f88/initial]
(2) [per-dir /www/web002/beta/] rewrite  -> http://beta.unclassified.de/
> 84.148.53.163 - - [05/Aug/2007:11:59:25 +0200] [unclassified.de/sid#8336258][rid#8481f88/initial]
(2) [per-dir /www/web002/beta/] explicitly forcing redirect with http://beta.unclassified.de/
> 84.148.53.163 - - [05/Aug/2007:11:59:25 +0200] [unclassified.de/sid#8336258][rid#8481f88/initial]
(1) [per-dir /www/web002/beta/] escaping http://beta.unclassified.de/ for redirect
> 84.148.53.163 - - [05/Aug/2007:11:59:25 +0200] [unclassified.de/sid#8336258][rid#8481f88/initial]
(1) [per-dir /www/web002/beta/] redirect to http://beta.unclassified.de/ [REDIRECT/301]

In a direct comparison, it doesn't do the "strip per-dir prefix" in the
first scenario. Why not?

Requesting the name of a directory, I would expect it to redirect to
that directory first, "beta" -> "beta/", as it's always the case. And
only then, it may regard the .htaccess file inside that directory and
that would work as expected, as I can see when trying that directly. Why
is the .htaccess file in a directory regarded when I'm not even inside
that directory? Why does entering a trailing slash or not make such a
great difference?

-- 
Yves Goergen "LonelyPixel" <nospam.list@unclassified.de>
Visit my web laboratory at http://beta.unclassified.de

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