You are here:Home»KB»Web Server».htaccess Proxy Examples
Friday, 04 December 2015 20:39

.htaccess Proxy Examples

Written by

There might be occasional times you want to supply content from another site but appear under another domain so you can keep control of these assets. Using .htaccess for this is not supported on all servers because Hosting companies can turn this off. I cannot remember why i have different version, but option 1 does work.

1

RewriteEngine  on
RewriteRule    ^(.*)$  http://demo.lancastrian-it.co.uk/$1  [P]
ProxyPassReverse / http://demo.lancastrian-it.co.uk/

2

This method rewrites the urls and asset paths on the fly.  The [PT] possibly could be [P,T]

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.sitewithcontent\.eu$ [NC]   
RewriteRule ^(.*)$ http://www.targetsite.co.uk/$1 [PT] 

3

RewriteRule ^.*$ http://www.google.co.uk/$0 [L,P]

4

RewriteRule ^/redmine/.*$ http://localhost:3000/$0 [L,P]

 

Read 1074 times