LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-28-2011, 04:17 PM   #1
ganninu
Member
 
Registered: Jul 2003
Distribution: RH 7.3/8.0/9.0, Debian Stable 3.0, FreeBSD 5.2, Solaris 8/9/10,HP-UX
Posts: 340

Rep: Reputation: 30
URL Rewriting without Redirection


I am an avid 'rewriter' so to speak...but today I got a peculiar request at work, and maybe you folks can help me out.

I want to rewrite URL 'foo.com' as 'bar.com' (in the browser address bar) but still display the content of 'foo.com'.

Can this be done at all?
 
Old 04-28-2011, 06:06 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,217
Blog Entries: 1

Rep: Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070
Hi,

If you're talking about vhosts on the same box, you can use mod_rewrite to rewrite foo.com to bar.com, while actually bar.com is an alias of foo.com? If you're using apache, something like the following should do:
Code:
...
ServerName foo.com
ServerAlias bar/com
RewriteCond %{HTTP_HOST} !^bar.com
RewriteRule (.*) http://bar.com/$1
...
In case that the 2 hosts are on different boxes you can setup bar.com as a reverse proxy of foo.com

Regards
 
Old 04-29-2011, 07:37 AM   #3
omgs
Member
 
Registered: Dec 2010
Posts: 64

Rep: Reputation: 6
You can use bar.com as ServerName and use UseCanonicalName On
 
  


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
URL rewriting/Centos lonster Linux - Newbie 1 09-28-2009 09:46 AM
Squid - URL Rewriting nitrohuffer2001 Linux - Enterprise 1 10-23-2008 08:44 PM
URL Rewriting mrpraveen.p Linux - Newbie 1 06-03-2008 08:07 AM
URL Rewriting getmeontop Linux - Newbie 1 04-02-2008 03:12 AM
url rewriting in localhost pamount Red Hat 0 01-08-2008 09:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:34 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
Open Source Consulting | Domain Registration