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,005 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

911 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

19 Experts available now in Live!

Get 1:1 Help Now