LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-30-2014, 10:11 PM   #1
x3nn3x
LQ Newbie
 
Registered: Apr 2011
Posts: 6

Rep: Reputation: 0
Apache Redirect For DOMAIN.COM/anything to NEW.com/Something.new


Hi,

I need to do a simple redirect, and I've search the interwebs for the answer to no avail.

I need to set all traffic destined for
old.com
to
new.com/this.url

I have the following set:

Code:
<VirtualHost 192.168.1.1:80>
        ServerName old.com
        Redirect 301 / http://new.com/this.url
</VirtualHost>
This does redirect all traffic to new.com/this.url.. However; if you append anything on to the end of "old.com", you will be directed to an error page on "new.com".

ie. I go to
old.com/index.html
I'm directed to
new.com/index.html <-- index.html doesn't exist on new.com, so I'm hit with an error... I need to be sent to "new.com/this.url"

I'm guessing it's a simple fix that I'm missing.. I just can't seem to find it.
Thank you for your assistance!
 
Old 10-30-2014, 11:00 PM   #2
linuxdood
LQ Newbie
 
Registered: Oct 2014
Posts: 3

Rep: Reputation: Disabled
You likely want a 301 redirect using mod_rewrite. Check out this post on it --

http://www.mediacollege.com/internet...ite/moved.html

Does this help? What makes sense from that, and what do you need more help with based on that post?
 
Old 10-30-2014, 11:33 PM   #3
x3nn3x
LQ Newbie
 
Registered: Apr 2011
Posts: 6

Original Poster
Rep: Reputation: 0
Hi,

That site was helpful, but unfortunately, not in this situation.
It appears that I hadn't given the correct information in the first place.. My bad.

The browser IS reporting that old.com/test.url has been changed to new.com/this.url
However; there is an error in the apache logs stating that the DocumentRoot (/var/www/html/new/home/test.url does not exist.

It should be noted that both the old and new URLs are on the same server listening on different IPs.

Perhaps I have missed something in the new.com config? I haven't changed that at all yet.... It looks like this:
Code:
<VirtualHost 192.168.1.2:80>
  RewriteEngine On
  RewriteCond %{HTTPS} !=on
  RewriteRule ^/?(.*) https://new.com/$1 [R,L]
</VirtualHost>
Thank you for your assistance.
 
Old 10-31-2014, 09:43 AM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Using meta refresh to create an instant client-side redirect
 
Old 11-02-2014, 04:08 PM   #5
x3nn3x
LQ Newbie
 
Registered: Apr 2011
Posts: 6

Original Poster
Rep: Reputation: 0
Hi,

This is the solution that I used.
Code:
<VirtualHost 192.168.1.1:80>
        ServerName old.com
        RedirectMatch permanent .* https://new.com/this.url
</VirtualHost>
It was very simple, as expected...

Thank you all for your assistance, it is appreciated.
 
  


Reply

Tags
apache, httpd, redhat, redirect



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache redirect for sub domain lahirushanaka Linux - Software 4 05-30-2014 12:40 PM
apache redirect from new to old domain server, but browser visible old domain name hocheetiong Linux - Server 1 05-19-2013 04:28 PM
[SOLVED] Creating 301 Permanent Redirect to a domain with same docroot as old domain. MarkToronto Linux - Newbie 1 05-15-2013 03:35 AM
Sub domain Redirect adam_1784 Linux - Software 2 01-16-2012 12:01 PM
Sub domain Redirect adam_1784 Linux - Software 2 01-11-2012 04:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration