oups, i don't understand you logic either ;)
ok i'll try to make things clearer
What i'm trying to do is this :
- check if the folder /var/www/hosts/${lowercase:%{SERVER_NAME}}/web exists
- if yes rewrite the request to this folder
- else if SERVER_NAME is found in the vhost.map (as first entry) then
redirect request to the master domain (vhost.map second entry)
I did some corrections and it should look like something like this, it's
far from working but at least the fisrst part seems to work
# if folder exists as a master domain
RewriteCond /var/www/hosts/${lowercase:%{SERVER_NAME}}/web ^(.+)$
# do the magic
RewriteRule ^/(.*)$ /var/www/hosts/${lowercase:%{SERVER_NAME}}/web/$1 [L]
# else redirect to the master domain
RewriteCond ${vhost:%1} ^(/.*)$
RewriteRule ^(.*) http://%2/$1 [QSA,L,R=301]
Hope it's clearer (might not be clever though) and that i won't have any
grabage characters again
Greg
Joshua Slive a écrit :
On 12/6/05, gregory duchesnes <[EMAIL PROTECTED]> wrote:
Anyone's got an idea, i'm still stuck on this one...
# define the map file
RewriteMap vhost txt:/www/conf/vhost.map
# deal with aliases as above
RewriteCond %{REQUEST_URI} ^/icons/
RewriteCond %{REQUEST_URI} ^/cgi-bin/
# if folder exists as a master domain
RewriteCond /var/www/hosts/${lowercase:%{SERVER_NAME}}/web ^(.+)$
# do the magic
RewriteRule ^/(.*)$ /www/hosts/${lowercase:%{SERVER_NAME}}/web/$1 [S=1]|
# else redirect to the master domain
RewriteCond ${vhost:%1} ^(/.*)$
RewriteRule ^(.*) http://%1/$1 [QSA,L,R=301]
I don't really understand the logic in the above. What I think you
want is something more like this:
# First canonicalize the hostname using the vhost alias map and
external redirects
# If the lower-cased server-name isn't in the map, then don't do anything
RewriteCond ${vhost:${lowercase:%{SERVER_NAME}}|default} !=default
RewriteRule (.*) http://${vhost:${lowercase:%{SERVER_NAME}:%1}$1 [R=301,L]
# Now interpolate the canonical vhosts, excluding some directories
RewriteCond %{REQUEST_URI} ^/icons/
RewriteCond %{REQUEST_URI} ^/cgi-bin/
RewriteRule ^/(.*)$ /www/hosts/${lowercase:%{SERVER_NAME}}/web/$1
But in the end, you're really going to have to find your way through
the RewriteLog. There is no other way to make sure you know what is
happening.
Joshua.
---------------------------------------------------------------------
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: [EMAIL PROTECTED]
" from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
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: [EMAIL PROTECTED]
" from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]