Link to home
Start Free TrialLog in
Avatar of Chopianissima
Chopianissima

asked on

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

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
Avatar of ahoffmann
ahoffmann
Flag of Germany image

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
ASKER CERTIFIED SOLUTION
Avatar of samri
samri
Flag of Malaysia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Chopianissima
Chopianissima

ASKER

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.)
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/