LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 12-03-2013, 03:05 AM   #1
gdizzle
Member
 
Registered: Jul 2012
Posts: 234

Rep: Reputation: Disabled
Redirect with URL not showing the new redirects URL link Apache RHEL 6


Hi All,

I need to have a webpage with the name for example www.abc.com to redirect to www.xyz.com however keeping www.abc.com in the URL bar.

Below is my Apache Config:

Code:
vim /etc/httpd/conf/httpd.conf
	 
<VirtualHost 10.10.10.11>
    ServerName  abc.com
    ServerAlias abc.com
    Redirect / www.xyz.com
</VirtualHost>

service httpd reload
From here when I access www.abc.com it redirects fine to www.xyz.com however www.xyz.com show in the URL Bar instead of www.abc.com. I did some googling and noticed this site: http://www.ontwerps.nl/domain-redire...th-url-masking

So I changed the code to:

Code:
vim /etc/httpd/conf/httpd.conf
	 
<VirtualHost 10.10.10.11>
    ServerName  abc.com
    ServerAlias abc.com
    RewriteEngine On
    RedirectMatch 301 (.*)$ www.xyz.com$1
</VirtualHost>
This does a permanent redirect fine however the URL name still changes to www.xyz.com

I was having problems with method 2 & 3 on http://www.ontwerps.nl/domain-redire...th-url-masking as If I had the above code would this conflict with making a frame/iframe do the job instead of Apache??

Is there an easier way I should be doing this or is there a better way with mod_rewrite??

A bit lost and confused.


Thanks
 
Old 12-03-2013, 03:20 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
If you're sending back a 301 then of course it's going to change the URL, that's a redirect. Why do you care what the URL says?? It's WRONG to want to preserve this. You do have options to proxy the service through the actual server, using a ProxyPass directive, but that will mean bouncing all the traffic through the first box forever more, which is probably, hopefully, unacceptable.
 
Old 12-03-2013, 03:39 AM   #3
gdizzle
Member
 
Registered: Jul 2012
Posts: 234

Original Poster
Rep: Reputation: Disabled
Why is it WRONG to want to preserve this when it's possible to be done?
Why do you care what the URL says? : Perhaps it's presentational and marketing/management it want the redirect to look the same as the destination.

I am not looking to use mod_proxy for a reverse proxy, I have been requested to make a URL look the same it can be done I am having problems getting this setup.

If you can help reply, if not ignore.

Thanks
 
Old 12-03-2013, 03:57 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
I did help you. You're already aware of the iframe solution, the other way is, as I said, to proxy it. You really need to understand what the technology is behind these things though, they both have significant faults, and it's rarely responsible to whitewash over security and technical issues in the name of marketing. The proper solution is to move content, update DNS, host the service in the right location in the first instance.
 
Old 12-03-2013, 04:09 AM   #5
gdizzle
Member
 
Registered: Jul 2012
Posts: 234

Original Poster
Rep: Reputation: Disabled
Thanks for your help, It looks to be a redundant redirect as the same site it's redirecting to is already on the same server, I will clean this up.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Cannot Redirect URL to another URL when the link is down with Squid marx_long Linux - Newbie 1 06-13-2010 09:59 PM
apache redirect url Radioactiveman Red Hat 1 07-29-2009 02:40 PM
How to redirect URL in apache chnlinux Linux - Newbie 1 01-08-2009 05:15 AM
URL redirect in apache maniannam Linux - Server 2 01-05-2009 02:03 AM
Apache Virtual URL Redirect nxny Linux - Software 0 07-19-2002 03:36 PM


All times are GMT -5. The time now is 09:04 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration