Link to home
Start Free TrialLog in
Avatar of lilyyan
lilyyan

asked on

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


Avatar of Suat M. Ozgur
Suat M. Ozgur
Flag of United States of America image

I would use an .htaccess file in the old server root including following:

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

Suat
Avatar of lilyyan
lilyyan

ASKER

Hi, thanks for your reply. Where i can find the .htaccess file?
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
Avatar of lilyyan

ASKER

Hi, thansk for your reply. Where i should put this file .htaccess?

Also any suggestion about the virtualHost entry? Thanks so mcuh
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
Avatar of lilyyan

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of Suat M. Ozgur
Suat M. Ozgur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lilyyan

ASKER

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?