• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 198
  • Last Modified:

Apache mod_rewrite from one server to another

I am afraid I no nothing about php or apache, sorry.
I am wanting to use mod_rewrite to link/redirect a page on one server to another page on a seperate server.  The reason being is I have built a system using asp which the first server does not support so need  a link from one to other, preferably maintaining the original URL in the address bar.

I have got a simple directive to work in the .htaccess file such as:

RewriteEngine on
RewriteRule ^ally.html$ bob.html

So with no knowledge I tried this:

RewriteEngine on
RewriteRule ^ally.html$ www.newdomain.co.uk/login.asp

Thanks for nay help with this.
  • 2
2 Solutions
rabbits2Author Commented:
So far I have figured it out to redirect to the correct place by:

RewriteRule ^ally.html$ http://www.hushclothing.co.uk/caukusadmin_login.asp

But still need assistance on how to include another directive to mask the url it is going to and maintain the original site url and if I set this url in the address bar to say read http://www.originalsite.co.uk
will I  need to change the pages within the ASP application to use the new domain as well surely not?


I think its possible to use proxying heres what I mean:

Rewrite ^ally.html$ http://www.hushclothing.co.uk/caukusadmin_login.asp [P]

That will server the http://www.hushclothing.co.uk/caukusadmin_login.asp page from the other server without
alerting the user :)

Hope this helps
rabbits2Author Commented:
None of these suggestions seem to work.  sorry.
Hm. xDamox proxy rewrite seems correct to me.

If the server is behind a firewall which denys outgoing http requests the Apache will not be able to proxy the requests from your old server to the new one. To check open a browser on the server and see if you can connect to www.apache.org. If you dont have a browser on your server check by trying to connect using telnet on port 80:

on command prompt:
telnet www.apache.org 80
If the connection is allowed the prompt will not appear again. Then type


and hit enter.

If you see HTML code being downloaded from www.apache.org the firewall is open. In that case your server can proxy the requests and the rewrite is wrong. If you dont get an valid answer your firewall is closed and the proxy rewrite will no work.

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now