LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   How to redirect from one page to another using apache and still retain original url? (http://www.linuxquestions.org/questions/linux-server-73/how-to-redirect-from-one-page-to-another-using-apache-and-still-retain-original-url-872753/)

peterson.julia 04-03-2011 04:36 PM

How to redirect from one page to another using apache and still retain original url?
 
Hi,
quesiton is how I can redirect http://www.thispage.com to http://my.page.com and still retail displaying http://www.thispage.com.

The issue is if I point in httpd.conf to directory where my.page.com it doesnt work because it knows it address.

Is there some other way?

Thx
Julie

smoker 04-03-2011 05:24 PM

It depends if they're on the same server.
If you have control over both domains, then use name based virtual hosting and use the ServerAlias directive to alias www.thispage.com to the virtual host of my.page.com
You only need my.page.com to exist as a physical site with files.

http://httpd.apache.org/docs/2.0/mod...ml#serveralias

peterson.julia 04-03-2011 05:39 PM

Quote:

Originally Posted by smoker (Post 4312736)
It depends if they're on the same server.
If you have control over both domains, then use name based virtual hosting and use the ServerAlias directive to alias www.thispage.com to the virtual host of my.page.com
You only need my.page.com to exist as a physical site with files.

http://httpd.apache.org/docs/2.0/mod...ml#serveralias

Thats what I did first time but it didnt work since moodle somehow konws its address and when I do that it transfers over and shows error....there is some module for rewriting addresses....

bathory 04-04-2011 12:49 AM

@OP

You can use a combination of mod_rewrite and mod_proxy to do what you want (if I can understand well what it is).
In the VirtualHost www.thispage.com definition use:
Code:

RewriteEngine on

RewriteRule (.*) http://my.page.com/$1 [P]
ProxyPassReverse / http://my.page.com/


smoker 04-04-2011 03:54 PM

It strikes me that if you try to get apache to mask or alias an address, then transfer that address to something (an app) that does it's own thing, you are in serious danger of creating a loop.

Personally I would try to get moodle to stop fighting back, rather than trying to get apache to overpower moodle.

jm2c


All times are GMT -5. The time now is 07:03 AM.