Forum Moderators: phranque

Message Too Old, No Replies

Keeping the typed URL

Rewriting with proxy but keep the typed URL

         

Xoverride

8:31 am on Jan 24, 2008 (gmt 0)

10+ Year Member



Hi Again. On this topic(http://www.webmasterworld.com/apache/3548601.htm) I got very usefull help what resulted in some code that could rewrite a subdomain for me. What I now want is this code to be modified so that it will keep the url that the user typed so:

xoverride.example.com should remain xoverride.example.com . In the following code this url is rewritten and I don't want that to happen:

Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST}!^(www\.example\.com)?$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.example\.com$ [NC]
RewriteRule .* http://www.example.com/example/exampaccount.form?account=%1 [P,L]

How can modify the code above so that the url (e.g. xoverride.example.com) remains the same?

jdMorgan

3:12 pm on Jan 24, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You still have a bug in your code, as noted in that previous thread.

Also, even if the code was correct, you might still have the problem of exposing the new URL. However, the code posted is not responsible for exposing the new URL. Use a server headers checker to test; I suspect that you will see that some other code is forcing an external redirect, and that is why the new URL is being exposed.

Jim

Xoverride

8:51 am on Jan 25, 2008 (gmt 0)

10+ Year Member



@ jdMorgen : You mentioned in the earlier tread that %1 should become %2 right.

I am running a java application and it could be indeed hat somehow i'm redirecting to a specific url. I will look into that further.

Thanks.

[edited by: Xoverride at 8:52 am (utc) on Jan. 25, 2008]