?
Solved

URL redirect in Apache server

Posted on 2007-07-31
10
Medium Priority
?
1,084 Views
Last Modified: 2008-01-09
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


0
Comment
Question by:lilyyan
  • 4
  • 4
8 Comments
 
LVL 17

Expert Comment

by:Suat Ozgur
ID: 19604042
I would use an .htaccess file in the old server root including following:

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

Suat
0
 

Author Comment

by:lilyyan
ID: 19604070
Hi, thanks for your reply. Where i can find the .htaccess file?
0
 
LVL 17

Expert Comment

by:Suat Ozgur
ID: 19604173
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:lilyyan
ID: 19604220
Hi, thansk for your reply. Where i should put this file .htaccess?

Also any suggestion about the virtualHost entry? Thanks so mcuh
0
 
LVL 17

Expert Comment

by:Suat Ozgur
ID: 19604318
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
 

Author Comment

by:lilyyan
ID: 19604394
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
 
LVL 17

Accepted Solution

by:
Suat Ozgur earned 1600 total points
ID: 19604465
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
 

Author Comment

by:lilyyan
ID: 19608139
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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month17 days, 8 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question