Question

I am not sure if .htaccess can handling this, I do search a lot's of related topics, but find no solution.

What I need is:

when my users visit my site: www.mysite.com

actually they got content from www.otherplace.com/folder1/folder2/folder3/page.html

I would like user's browser address shows: www.mysite.com or www.mysite.com/page.html also fine for me, but not show's anything about the site: www.otherplace.com....

page.html is just single page, tiddlywiki, :)

thank you. :)

Was it helpful?

Solution

If you are using apache this can be done with proxy. Open /etc/apache2/mods-available/proxy.conf and add your's definition

<IfModule mod_proxy.c>
        ProxyRequests Off

        <Proxy *>
                AddDefaultCharset off
                Order Allow,Deny
                Allow from all
        </Proxy>

    ProxyPass / http://www.otherplace.com/folder1/folder2/folder3/page.html
    ProxyPassReverse / http://www.otherplace.com/folder1/folder2/folder3/page.html

</IfModule>

I use similar configuration to host multiple services that listen on different ports (e.g. Jenkins, codebrag e.t.c) with on http each with their own directory e.g

ProxyPass         /jenkins  http://localhost:8080/jenkins
ProxyPassReverse  /jenkins  http://localhost:8080/jenkins

and the url is http://my.domain.com/jenkins/ instead of http://my.domain.com:8080/jenkins

Remember to restart apache sudo service apache2 restart or another equivalent

Rewrite is another option but IMO proxy is easier to set up although it's not so powerful.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top