URL redirect in Apache server

hello,

this is a continuing question about the URL  redirect.

our old web server name is : abc.myschool.edu, Now it has been renamed to new.myschool.edu . so this new web server still has the same IP address as the old one.

My question is: how to redirect the traffic from abc.myschool.edu to new.myschool.edu?

i have tried the following in the httpd.conf file--- add one entry for vitual host:

---------------
<VirtualHost  theIP:80>
 ServerName abc.myschool.edu
 DocumentRoot /opt/IBMIHS/htdocs/en_US
 RewriteEngine On
 RewriteRule .*  http://new.myschool.edu/ [L,R]
</VirtualHost>
---------

After made the above change, the result is: when I type http://new.myschool.edu/ or http://abc.myschool.edu, the URL seems in a infinate loop. in the status bar: it shows redirect to : http://new.myschool.edu/. then it just continues showing this status....

Any instruction is highly appreciate,
lilyyan


lilyyanAsked:
Who is Participating?
 
Suat OzgurWeb / Application DeveloperCommented:
Forget .htaccess in this case. It is not something that you need.

But you still got abc.myschool.edu domain name, right?

If yes, then yes, you need to create a Virtual Host for this domain name and just set its DocumentRoot same as the new one's. You can read following for really nice/detailed information:
http://httpd.apache.org/docs/2.0/vhosts/name-based.html

If no, then I really am not sure what you are asking for. All will be happened when someone enters abc.myschool.edu as the URL will be a "server not found" error.

Suat
0
 
Suat OzgurWeb / Application DeveloperCommented:
I would use an .htaccess file in the old server root including following:

Redirect 301 / http://www.new.myschool.edu/

Suat
0
 
lilyyanAuthor Commented:
Hi, thanks for your reply. Where i can find the .htaccess file?
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
Suat OzgurWeb / Application DeveloperCommented:
it would be a new file that you would create. It is Apache directive file and its name is

.htaccess

You can use notepad to create it. Select All Files as Save As type and simply type .htaccess as the full file name. Single dot and htaccess. Looks like no name and a long extension.

Actually, following page might help:
http://www.webconfs.com/how-to-redirect-a-webpage.php
See "Redirect Old domain to New domain" section. It used RewriteRule.

Suat
0
 
lilyyanAuthor Commented:
Hi, thansk for your reply. Where i should put this file .htaccess?

Also any suggestion about the virtualHost entry? Thanks so mcuh
0
 
Suat OzgurWeb / Application DeveloperCommented:
You need to put this file into the root folder of the server that abc.myschool.edu URL is currently leading.

I wonder if I got your question wrong. You still have abc.myschool.edu is live, right? So you can redirect traffic from those old site to new site. Otherwise, if someone types abc.myschool.edu then it will be already not resolved if it is not existing.

Anyway, another resource about redirection (same solution but a little bit more description):
http://www.tamingthebeast.net/articles3/changing-domain-names.htm

Also, about virtual server entry in the conf file: I think you mean that you are allowed to change the Apache conf file, right? Then I think just creating a servername with the old servername and pointing the document root to the new server would the job (this comment totally assumes that both virtual servers are on the same server).

<VirtualHost *:80>
    ServerName abc.myschool.edu
    DocumentRoot "\usr\var\vhosts\new.myschool.edu.folder\" //or something like this
</VirtualHost>

I hope it helps.
Suat
0
 
lilyyanAuthor Commented:
Hi, thanks so muchfor your reply. i will try your advice later...

>>You still have abc.myschool.edu is live, right?
no, this abc.myschool.edu is renamed to new.myschool.edu. it's not alive any more.
0
 
lilyyanAuthor Commented:
Hi, thanks so much for your reply. got one question:

>>But you still got abc.myschool.edu domain name, right?
how to check if abc.myschool.edu  is still a domain name? should i check it on DNS server?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.