logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: redirect request and shut the server down
Author
sahillihas8487



Joined: 02 Sep 2009
Posts: 8

PostPosted: Wed 02 Sep '09 21:13    Post subject: redirect request and shut the server down Reply with quote

Hi to All ..........

I have a website says abc.com and another website says def.com.
my website def.com is on wamp and its working fine......
But now i want to add abc.com to my def.com.so that all the link for abc.com will be redirected to def.com.and the server on which abc.com is running will be shut down after the redirection is successful.that means we are not going to use the server of abc.com after the redirection.
Please suggest anything.......... what can be the better solution ............ Question .

Thanks in Advance..................
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Wed 02 Sep '09 21:29    Post subject: Reply with quote

A simple way to redirect all request is a rewrite rule on the

in the vhost of abc.com
Code:

RewriteEngine On
RewriteRule (.*) http://def.com%{REQUEST_URI}
Back to top
sahillihas8487



Joined: 02 Sep 2009
Posts: 8

PostPosted: Wed 02 Sep '09 21:37    Post subject: Reply with quote

Thanks for your immediate reply.......

well........I am not using vhosting..........
Is it good to use this name based vhosting....
also what kind of changes need to be done means over DNS...and others..
and what about contents of def.com?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Wed 02 Sep '09 23:44    Post subject: Reply with quote

Well you don't need a vhost. vhost means virtual host. So you just could put that code into your Directory entry in your http.conf

other changed don't need to be done, if people shall see that new url.

The redirect code I posted redirects all requests to the new url.

e.g.

http://abc.com/name.ext would be redirected to http://def.com/name.ext

Quote:

what about contents of def.com?


What do you mean with that? Please secify that.
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Thu 03 Sep '09 0:43    Post subject: Reply with quote

@james,
I don't think they realize it can be done with one server, the wamp

If you shut down the second, how does it handle the next person?

Stuff/concepts are being lost in translation I think

@sahillihas8487

what is DocumentRoot of def.com on WAMP
Back to top
sahillihas8487



Joined: 02 Sep 2009
Posts: 8

PostPosted: Thu 03 Sep '09 3:07    Post subject: Reply with quote

thanks for your reply.............

But i think you all are not getting my question............................
I want to run both website simultaneously abc.com and def.com .My question is concerned that the webserver of abc.com is going to shut down permanently and i want to run two website through the webserver of def.com.about the document root i will copy all the content to new webserver and also to run two website i think we needt to add canonical name at the DNS level ....
can it be possible to use .htaccess for good response ...if it is then how could i do that ?
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Thu 03 Sep '09 7:19    Post subject: Reply with quote

Thank you for that, I understand.

def.com is on the wamp, you will use DNS to point abc.com to the same server (the wamp). You will use VHosts as well.

I still need to know what the DocumentRoot on the wamp is for def.com, I do not know the the wamp file system layout exactly and it is needed to set it all up.

You do know you could have both sites on the one server yes?
Back to top
sahillihas8487



Joined: 02 Sep 2009
Posts: 8

PostPosted: Thu 03 Sep '09 20:36    Post subject: Reply with quote

on the wamp..document root is for def.com....
for abc .com i will have to mention document root in vhost configuration.and need to copy all the items to that specified folder.............so that when somebody access the abc.com then the content will serve from abc.com document root (in vhost configuration) which is on the same webserver of def.com..................
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Sat 05 Sep '09 20:10    Post subject: Reply with quote

in DNS point abc.com to the wamp servers IP

conf/extra/httpd-vhosts.conf
Code:
NameVirtualHost *:80

<VirtualHost _default_:80>
# this is why I wanted to know the DocumentRoot for def.com which
# you've refused to give, make it work with what is there
    DocumentRoot "/same/path/as/def.com"
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@abc.com
    DocumentRoot "/some/path/to/abc.com"
    ServerName www.abc.com
    ServerAlias abc.com
    ErrorLog "logs/abc.com-error.log"
    CustomLog "logs/abc.com-access.log" common
</VirtualHost>



in conf/httpd.conf down near the bottom of the file remove the comment (#) from the beginning of this line

Include conf/extra/httpd-vhosts.conf
Back to top


Reply to topic   Topic: redirect request and shut the server down View previous topic :: View next topic
Post new topic   Forum Index -> Apache