rewriting a proxy pass

Using a single web hosting account to host multiple sites

rewriting a proxy pass

Postby spaceman » Fri Jan 04, 2008 8:30 am

I'm using a proxypass of /dir to point to a different server...
example.com is on one server; example.com/dir is on another.

An entire URL looks like this example.com/dir/dir2/page34.html

Is there a way to still use the proxypass, but rewrite the /dir out of the URL altogether?

If so how do I then rewrite the urls I have on /dir which anchor to example.com/dir

Thanks & sorry if I have this complete backwards. I'm still trying to wrap my head around rewrite.
spaceman
 
Posts: 4
Joined: Fri Jan 04, 2008 8:24 am

Postby richardk » Fri Jan 04, 2008 1:57 pm

Like /abc.html to /dir/abc.html? This should work in a .htaccess file
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^abc\.html$ /dir/abc.html [QSA,L]

If you don't put it in a .htaccess you will need the PT flag.

Or you can proxy with mod_rewrite and the P flag.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby spaceman » Fri Jan 04, 2008 2:55 pm

richardk wrote:Like /abc.html to /dir/abc.html? This should work in a .htaccess file
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^abc\.html$ /dir/abc.html [QSA,L]

If you don't put it in a .htaccess you will need the PT flag.

Or you can proxy with mod_rewrite and the P flag.


Yes that seems like it looks right.

That doesn't handle the rewriting of embedded (?) links though does it?
spaceman
 
Posts: 4
Joined: Fri Jan 04, 2008 8:24 am

Postby richardk » Sat Jan 05, 2008 10:09 am

Mod_rewrite never changes any links inside pages, it works on incoming requests only.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 27 guests

cron