[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
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
Medium Priority
?
1,019 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1500 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

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.

Question has a verified solution.

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

Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month13 days, 1 hour left to enroll

650 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