Solved

How can I redirect one URL to another (including subdirectories) without changing the URL in address bar (so something like mod_rewrite features)?

Posted on 2004-08-12
4
1,004 Views
Last Modified: 2010-03-04
In a mod_rewrite, if the rewriterule result contains an external URL such as http://www.example.com/$1 then it actually redirects instead of rewriting, because the result URL must be internal for it to work normally.

What I want is basically explained in my topic - How can I redirect one URL to another (including subdirectories) without changing the URL in address bar (so something like mod_rewrite features)?

I heard about using ProxyPass but am afraid of how to use it, implement it, etc.

So any suggestions that might help?

If it helps, then this is what I have right now in my mod_rewrite (and it achieves exactly what I want, except that it redirects and does not keep the original URL in address bar.)

.HTACCESS CONTENT (in http://blog.kinggary.com/ ):
RewriteRule ^(.*)$ http://gary.blogs.com/$1
0
Comment
Question by:Chopianissima
  • 2
4 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 11791629
you cannot redirect without hanging URL in addressbar (except using malware on the client: JavaScript, ActiveX etc.)

If you just need to rewrite, then you could use RewriteRule with [P] flag
0
 
LVL 15

Accepted Solution

by:
samri earned 500 total points
ID: 11794301
I would suggest for you to explore using ProxyPass (or reverse proxy concept).  This approach would bring the remote webserer namespace into yours.

Take a look at apache mod_proxy module (http://httpd.apache.org/docs-2.0/mod/mod_proxy.html).

Specific to your requirement, I would personnally go for using proxy.  Just jump to a example on Apache website :
http://httpd.apache.org/docs-2.0/mod/mod_proxy.html#examples

You could include this in the Vhost for bloggs.kinggary.com (a suggestion).
--
ProxyRequests On
ProxyVia On

<Proxy *>
  Order deny,allow
  Deny from all
  Allow from internal.example.com
</Proxy>

Reverse Proxy
ProxyRequests Off

<Proxy *>
  Order deny,allow
  Allow from all
</Proxy>

ProxyPass             /   http://gary.blogs.com/
ProxyPassReverse  /   http://gary.blogs.com/
0
 

Author Comment

by:Chopianissima
ID: 11795477
Please keep in mind I'm still on Apache 1.3.31.

Also, mod_proxy module does not load with my Apache; what do I need to put in to make it load with Apache? I tried putting in the line to load the .so and the .c for mod_proxy but I just get an error saying there is an error with the httpd.conf (so I just revert my changes.)
0
 
LVL 15

Expert Comment

by:samri
ID: 11798996
hi Chopianissima,

Not a problem, Apache 1.3.x have a corresponding proxy module as well.  Check you modules directory for mod_proxy.so (which I think). (http://httpd.apache.org/docs/mod/mod_proxy.html).  Take a look at forward/reverse proxy section (http://httpd.apache.org/docs/mod/mod_proxy.html#forwardreverse).

Just load the proxy module, and


#  ProxyRequests On
  ProxyRequests Off
  <Proxy *>
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1 192.168
 </Proxy>

ProxyPass /stokely http://www.stokely.com/
ProxyPassReverse /stokely http://www.stokely.com/

ProxyPass /eskimo http://www.eskimo.com/
ProxyPassReverse /eskimo http://www.eskimo.com/
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now