Apache 将多个域重定向到其他目录
我有 1 个 IP 号 83.87.163.224,我有 4 个多个域名: www.alurelingerie.nl - www.aaamsterdam.info - www.webshopdesigners.nl - www.rtps.eu
每个域名必须重定向到我的 Apache 服务器上的子目录。我尝试使用 VirtualHost *:80 但不起作用...它没有重定向到正确的子目录... 它只重定向到第一个虚拟主机...
我想要的是: www.alurelingerie.nl >必须重定向到http://83.87.163.224/alurelingerie/www.aaams
terdam.info>必须重定向到http://83.87.163.224/aaamsterdam/
www.webshopdesigners.nl>必须重定向到http://83.87.163.224/webshopdesigners/www.rtps.eu
>必须重定向到 http://83.87.163.224/rtps/
rootdir 83.87.163.224 没有子目录 >必须重定向到 http://83.87.163.224/startpagina/
有人可以帮我为我的 Apache 2.2 服务器进行设置吗... THX,抱歉我的英语不好......
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...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
取决于“重定向”一词的确切含义。如果您指的是文档根目录,那么虚拟主机正是您所需要的:
等等..如果“重定向”您的意思是 HTTP 重定向(301、302),那么您应该检查 Apache 的 mod_rewrite,它非常有用简单 - 将所有域重定向到一个位置,并将所有请求放入 php 脚本,然后确定您尝试访问的域并发出 Location: /new-location 标头。
我很确定这也可以在没有 PHP 的情况下完成,但无法立即想到任何东西,也许使用 [R=301,L] 的 RewriteCond 和 RewriteRule 。
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:
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].