1. Home
  2. WordPress & websites
  3. Can I use ProxyPass on your services?

Can I use ProxyPass on your services?

Sometimes you want to present the content of a website under a different domain, something you can use ProxyPass for example.

On our servers, this can be done via the .htaccess file that you put in the root of your domain (the one that should appear in the browser’s address bar). Add content such as the following to the file to activate the proxy function:

RewriteRule ^(.*)$ http://www.oderland-demo.se/$1 [P,E=Proxy-Host:www.oderland-demo.se]

Make sure that the domain is written in the same way both times it appears in the file as shown in the example above. Replace www.oderland-demo.se with the domain/URL you want to fetch for the proxy page. If you want to present a sub-page of an existing page on a new domain, this works fine:

RewriteRule ^(.*)$ http://www.oderland-demo.se/sub-page/$1 [P,E=Proxy-Host:www.oderland-demo.se]

Replace www.oderland-demo.se/sub-page with the address of your current site (which should be visible on your own domain) and replace www.oderland-demo.se with the domain of your current site.

Keep in mind that a proxy does not rewrite any data on the page you are fetching, so links on the page will replace the address in the browser’s address bar if they are entered as absolute. If you use relative links, it will work as intended on your own domain.

Was this article helpful?

Related Articles