SV: SV: [users@httpd] Rewrite on Windows-server (subdomain)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sorry, but can you help me?

Med venlig hilsen / Best regards
Dennis Madsen
 
DeMaWeb
http://www.demaweb.dk
CVR-nr.: 2895 9486
-----Oprindelig meddelelse-----
Fra: Robert Ionescu [mailto:robsiegen@xxxxxxxxxxxxxx] 
Sendt: 3. marts 2006 15:01
Til: users@xxxxxxxxxxxxxxxx
Emne: Re: SV: [users@httpd] Rewrite on Windows-server (subdomain)

Dennis Madsen wrote:
> Should I insert a rewrite rule in my virtual host for myhp.dk? I have
this:
> 
> <VirtualHost *>
> DocumentRoot c:/www/myhp.dk/www
> ServerName myhp.dk
> ServerAlias *.myhp.dk
> ServerAdmin admin@xxxxxxx
> php_admin_value open_basedir c:/www/myhp.dk/www/
> CustomLog c:/www/myhp.dk/access.log combined
> ErrorLog c:/www/myhp.dk/error.log
> </VirtualHost>

Hello Dennis.

In this case (rewrite within the document root), you can easily use 
inside your <virtualhost *> (just add the rules somewhere between the 
other directives):

RewriteEngine On
RewriteCond %{HTTP_HOST} ^([^.]+)\.myhp\.dk$
RewriteCond %1 !^www$
RewriteCond c:/www/myhp.dk/www/%1 -d
RewriteRule ^(.*) /%1/$1 [L]

You don't need any looping protection here, because there is no internal 
redirect in per-server context. Since you're on a windows system, there 
are no concerns about security. But if would use e.g. Linux, I'd 
strongly recommend to prefix the substitution with the document root 
(like RewriteRule ^(.*) /var/www/html/%1/$1 [L]), but again, there is no 
need here to use RewriteRule ^(.*) c:/www/myhp.dk/www/%1/$1 [L]

So you might test the rules inside your <virtualhost *>.

-- 
Robert

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




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



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux