views:

37

answers:

4

I have 1 IP number 83.87.163.224 and I have 4 multiple domainnames: www.alurelingerie.nl - www.aaamsterdam.info - www.webshopdesigners.nl - www.rtps.eu

Every domeinname must redirect to a sub dir on my Apache server. I tried to work with VirtualHost *:80 but I doesn't work... It doens't redirect to the correct subdir... It did only redirect to the first VirtualHost...

What I want is: www.alurelingerie.nl > must be redirected to http:// 83.87.163.224/alurelingerie/

www.aaamsterdam.info > must be redirected to http:// 83.87.163.224/aaamsterdam/

www.webshopdesigners.nl > must be redirected to http:// 83.87.163.224/webshopdesigners/

www.rtps.eu > must be redirected to http:// 83.87.163.224/rtps/

the rootdir 83.87.163.224 without a subdir > must be redirected to http:// 83.87.163.224/startpagina/

Can someone help me to set this up for my Apache 2.2 server... THX, sorry for my bad English...

A: 

Depends on what exactly you mean by the word "redirect". If you're referring to the document root, then virtual hosts are exactly what you need:

NameVirtualHost *:80

<VirtualHost *:80>
  ServerName alurelingerie.nl
  ServerAlias www.alurelingerie.nl
  DocumentRoot /home/websites/alurelingerie.nl
</VirtualHost>

<VirtualHost *:80>
  ServerName yourseconddomain.com
  ServerAlias www.yourseconddomain.com
  DocumentRoot /home/websites/yourseconddomain.com
</VirtualHost>

And so on.. If by "redirect" you mean an HTTP redirect (301, 302) then you should check out mod_rewrite for Apache, it's quite simple - redirect all your domains to one place and place all requests onto a php script, which then determines which domain you were trying to access and issues a Location: /new-location header.

I'm quite sure this could be done without PHP too, but can't think of anything straight away, maybe RewriteCond and RewriteRule with [R=301,L].

kovshenin
A: 

thx for your help/answer....

www.oorbellenboutique.nl > must be directed to the path f:/inetpub/wwwroot/oorbellenboutique/index.html

My DNS: A *.oorbellenboutique.nl → 83.87.163.224 A oorbellenboutique.nl → 83.87.163.224 CNAME www.oorbellenboutique.nl → oorbellenboutique.nl

BUT now I see in my browser my URL http:// 83.87.163.224/oorbellenboutique/index.html but it must be: www.oorbellenboutique.nl/index.html

How can/must I do that???? If I change:

RewriteRule ^/$ http:// 83.87.163.224/oorbellenboutique/ [R]

into

RewriteRule ^/$ http:// www.oorbellenboutique.nl [R]

I get an error???

This is my virtuelhost:

VirtualHost *:80

ServerName oorbellenboutique.nl

ServerAlias www.oorbellenboutique.nl

DocumentRoot f:/inetpub/wwwroot/oorbellenboutique

ServerSignature Email

ServerAdmin [email protected]

Options +Includes

SetOutputFilter INCLUDES

AcceptPathInfo On

RewriteEngine on

ReWriteCond %{SERVER_PORT} 80

RewriteRule ^/$ http:// 83.87.163.224/oorbellenboutique/ [R]

/VirtualHost

WSD
A: 

Dear members, I found this piece of code but it gives a internal 500 error. Can somebody help me with this code plz to solve the problem....

Sample 2 (Manual redirection for all domains and subdomains) This .htaccess file sample will direct all domain names and sub domains to folder names that you specify. 1) Use this sample if you have multiple domain names that you want to direct to the same folder. 2) Use this sample if you want to direct your domains to folders with names other than mydomain.com and subdomain.mydomain.com 3) You will need to make a separate entry for each of your domains in your .htaccess file.

RewriteEngine on

RewriteRule ^([^.?]+[^.?/])$ $1/ [R,L]

RewriteCond %{HTTP:Host} ^(?:www.)?domain.com$

RewriteRule (.*) /folder1/$1 [NC,L,NS]

RewriteCond %{HTTP:Host} ^(?:www.)?otherdomain.com$

RewriteRule (.*) /folder2/$1 [NC,L,NS]

RewriteCond %{HTTP:Host} ^(?:subdomain.domain.com)?$

RewriteRule (.*) /folder3/$1 [NC,L,NS]

WSD
A: 

Dear members, can someone tell me plz why I get an internal 500 error with this code????

RewriteEngine on

RewriteRule ^([^.?]+[^.?/])$ $1/ [R,L]

RewriteCond %{HTTP:Host} ^(?:www.)?domain.com$

RewriteRule (.*) /folder1/$1 [NC,L,NS]

RewriteCond %{HTTP:Host} ^(?:www.)?otherdomain.com$

RewriteRule (.*) /folder2/$1 [NC,L,NS]

RewriteCond %{HTTP:Host} ^(?:subdomain.domain.com)?$

RewriteRule (.*) /folder3/$1 [NC,L,NS]

WSD