Jump to content

[SOLVED] Rewrite [P] to server with absolute links


Zilvermeeuw

Recommended Posts

Hi all!

 

I have two servers, server1 and server2. From the internet port 80 is pointed to server1. The webserver runs ok. I want to have a subdir (http://server1/server2) to get access to server2. Also from the internet. There is no direct access from the internet to server2.

 

On server1 I made a directory server2 with a .htaccess file:

RewriteEngine on
Rewriterule ^(.*)$ http://server2/$1 [P]

 

On server2 I have an index.html:

<a href="index2.html">index2</a><br>
<a href="/index2.html">/index2</a>

 

When I open the address http://server1/server2 in my web browser, the first link (index2.html) points to: http://server1/server2/index2.html. Which is ok.

 

The second link (/index2.html) points to: http://server1/index2.html. Which is NOT ok, because its pointing to server1 and not to server2.

 

On server2 I have other applications which uses the absolute links (with the / at the beginning).

 

How can I solve this?

 

 

Link to comment
Share on other sites

Use a different path in the HTML.

 

 

Of course it's going to go where you tell it to go x.x.

 

 

/ means root of, so you're essentially telling it to go to the root of the website, and then index2.html (hence blah.com/index2.html).

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.