URL re-writing problem

--001636920c1344f64e047b4e1fcd
Content-Type: text/plain; charset=ISO-8859-1

Hi all,

I am very new to httpd server. And i have a immediate problem to solve. My
server instance is running on centos box.

If a request comes to my server as

----
http://sub-domain.domain.com
---

This should be translated to

---
http://domain.com/key/sub-domain
---

I have configured many virtual host on my server. But this is quite a case
and i am running out of ideas


Any suggestion: what should i do?




Regards,
Vijay Shanker Dubey

--001636920c1344f64e047b4e1fcd
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div>Hi all,</div><div><br></div><div>I am very new to httpd server. And i =
have=A0a=A0immediate=A0problem=A0to solve.=A0My server instance is running =
on centos box.</div><div><br></div><div>If a request comes to my server as<=
/div><div>

<br></div><div>----</div><div><a href=3D"http://sub-domain.domain.com">http=
://sub-domain.domain.com</a></div><div>---</div><div><br></div><div>This sh=
ould be translated to=A0</div><div><br></div><div>---</div><div><a href=3D"=
http://domain.com/key/sub-domain">http://domain.com/key/sub- domain</a></div=
>

<div>---</div><div><br></div><div>I have configured many virtual host on my=
server. But this is quite a case and i am running out of ideas=A0</div><di=
v><br></div><div><br></div><div>Any=A0suggestion: what should i do?</div><d=
iv>

<br></div><div><br></div><div><br></div><br clear=3D"all">Regards,<br>Vijay=
Shanker Dubey<br><br>

--001636920c1344f64e047b4e1fcd--
vijay shanker [ Di, 22 Dezember 2009 10:49 ] [ ID #2026759 ]

RE: URL re-writing problem

Vijay,
If you have a small number of subdomains, I would try, for each one:

<virtualhost *:80>
ServerName subdomainN.domain.com
ProxyRequests off
ProxyPass / http://domain.com/key/subdomainN
ProxyPassReverse / http://domain.com/key/subdomainN
</virtualhost>

Otherwise I would try a rewrite rule such as:

RewriteCond %(HTTP_HOST) (.+).domain.com
RewriteRule ^(.+)$ %(HTTP_HOST)$1 [C]
RewriteRule (.+).domain.com(.*) http://domain.com/key/$1$2 [L]

The first rule is required so that pattern matching can extract the subdoma=
in name. The condition can be removed if the rewrite rules appear in a vhos=
t.

Oliver


From: vijay shanker [mailto:vijay.shad [at] gmail.com]
Sent: December 22, 2009 4:49 AM
To: users [at] httpd.apache.org
Subject: [users [at] httpd] URL re-writing problem

Hi all,

I am very new to httpd server. And i have=A0a=A0immediate=A0problem=A0to so=
lve.=A0My server instance is running on centos box.

If a request comes to my server as

----
http://sub-domain.domain.com
---

This should be translated to=A0

---
http://domain.com/key/sub-domain
---

I have configured many virtual host on my server. But this is quite a case =
and i am running out of ideas=A0


Any=A0suggestion: what should i do?




Regards,
Vijay Shanker Dubey

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe [at] httpd.apache.org
" from the digest: users-digest-unsubscribe [at] httpd.apache.org
For additional commands, e-mail: users-help [at] httpd.apache.org
Oliver Schoenborn [ Di, 22 Dezember 2009 15:51 ] [ ID #2026761 ]

Re: URL re-writing problem

--00504502cc3568730f047b5b1245
Content-Type: text/plain; charset=ISO-8859-1

Only this %(HTTP_HOST) should be in curly brackets


On Wed, Dec 23, 2009 at 1:51 AM, Oliver Schoenborn <schoenb [at] cae.com> wrote:

> Vijay,
> If you have a small number of subdomains, I would try, for each one:
>
> <virtualhost *:80>
> ServerName subdomainN.domain.com
> ProxyRequests off
> ProxyPass / http://domain.com/key/subdomainN
> ProxyPassReverse / http://domain.com/key/subdomainN
> </virtualhost>
>
> Otherwise I would try a rewrite rule such as:
>
> RewriteCond %(HTTP_HOST) (.+).domain.com
> RewriteRule ^(.+)$ %(HTTP_HOST)$1 [C]
> RewriteRule (.+).domain.com(.*) http://domain.com/key/$1$2 [L]
>
> The first rule is required so that pattern matching can extract the
> subdomain name. The condition can be removed if the rewrite rules appear in
> a vhost.
>
> Oliver
>
>
> From: vijay shanker [mailto:vijay.shad [at] gmail.com]
> Sent: December 22, 2009 4:49 AM
> To: users [at] httpd.apache.org
> Subject: [users [at] httpd] URL re-writing problem
>
> Hi all,
>
> I am very new to httpd server. And i have a immediate problem to solve. My
> server instance is running on centos box.
>
> If a request comes to my server as
>
> ----
> http://sub-domain.domain.com
> ---
>
> This should be translated to
>
> ---
> http://domain.com/key/sub-domain
> ---
>
> I have configured many virtual host on my server. But this is quite a case
> and i am running out of ideas
>
>
> Any suggestion: what should i do?
>
>
>
>
> Regards,
> Vijay Shanker Dubey
>
> ------------------------------------------------------------ ---------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe [at] httpd.apache.org
> " from the digest: users-digest-unsubscribe [at] httpd.apache.org
> For additional commands, e-mail: users-help [at] httpd.apache.org
>
>

--00504502cc3568730f047b5b1245
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Only this %(HTTP_HOST) should be in curly brackets <br><br><br><div class=
=3D"gmail_quote">On Wed, Dec 23, 2009 at 1:51 AM, Oliver Schoenborn <span d=
ir=3D"ltr"><<a href=3D"mailto:schoenb [at] cae.com">schoenb [at] cae.com</a>></=
span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, =
204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Vijay,<br>
If you have a small number of subdomains, I would try, for each one:<br>
<br>
<virtualhost *:80><br>
=A0 =A0ServerName <a href=3D"http://subdomainN.domain.com" target=3D"_blan=
k">subdomainN.domain.com</a><br>
=A0 =A0ProxyRequests off<br>
=A0 =A0ProxyPass =A0 =A0 =A0 =A0 / =A0 <a href=3D"http://domain.com/key/su=
bdomainN" target=3D"_blank">http://domain.com/key/subdomainN</a><br>
=A0 =A0ProxyPassReverse =A0/ =A0 <a href=3D"http://domain.com/key/subdomai=
nN" target=3D"_blank">http://domain.com/key/subdomainN</a><br>
</virtualhost><br>
<br>
Otherwise I would try a rewrite rule such as:<br>
<br>
RewriteCond %(HTTP_HOST) (.+).<a href=3D"http://domain.com" target=3D"_blan=
k">domain.com</a><br>
RewriteRule ^(.+)$ %(HTTP_HOST)$1 =A0 =A0[C]<br>
RewriteRule (.+).<a href=3D"http://domain.com" target=3D"_blank">domain.com=
</a>(.*) <a href=3D"http://domain.com/key/$1$2" target=3D"_blank">http://do=
main.com/key/$1$2</a> =A0 =A0 [L]<br>
<br>
The first rule is required so that pattern matching can extract the subdoma=
in name. The condition can be removed if the rewrite rules appear in a vhos=
t.<br>
<br>
Oliver<br>
<br>
<br>
From: vijay shanker [mailto:<a href=3D"mailto:vijay.shad [at] gmail.com">vijay.s=
had [at] gmail.com</a>]<br>
Sent: December 22, 2009 4:49 AM<br>
To: <a href=3D"mailto:users [at] httpd.apache.org">users [at] httpd.apache.org</a><br=
>
Subject: [users [at] httpd] URL re-writing problem<br>
<div><div></div><div class=3D"h5"><br>
Hi all,<br>
<br>
I am very new to httpd server. And i have=A0a=A0immediate=A0problem=A0to so=
lve.=A0My server instance is running on centos box.<br>
<br>
If a request comes to my server as<br>
<br>
----<br>
<a href=3D"http://sub-domain.domain.com" target=3D"_blank">http://sub-domai=
n.domain.com</a><br>
---<br>
<br>
This should be translated to=A0<br>
<br>
---<br>
<a href=3D"http://domain.com/key/sub-domain" target=3D"_blank">http://domai=
n.com/key/sub-domain</a><br>
---<br>
<br>
I have configured many virtual host on my server. But this is quite a case =
and i am running out of ideas=A0<br>
<br>
<br>
Any=A0suggestion: what should i do?<br>
<br>
<br>
<br>
<br>
Regards,<br>
Vijay Shanker Dubey<br>
<br>
</div></div><div><div></div><div class=3D"h5">-----------------------------=
----------------------------------------<br>
The official User-To-User support forum of the Apache HTTP Server Project.<=
br>
See <URL:<a href=3D"http://httpd.apache.org/userslist.html" target=3D"_b=
lank">http://httpd.apache.org/userslist.html</a>> for more info.<br>
To unsubscribe, e-mail: <a href=3D"mailto:users-unsubscribe [at] httpd.apache.or=
g">users-unsubscribe [at] httpd.apache.org</a><br>
=A0 " =A0 from the digest: <a href=3D"mailto:users-digest-unsubscribe=
[at] httpd.apache.org">users-digest-unsubscribe [at] httpd.apache.org</a><br>
For additional commands, e-mail: <a href=3D"mailto:users-help [at] httpd.apache.=
org">users-help [at] httpd.apache.org</a><br>
<br>
</div></div></blockquote></div><br>

--00504502cc3568730f047b5b1245--
Igor Cicimov [ Mi, 23 Dezember 2009 02:16 ] [ ID #2026887 ]

Re: URL re-writing problem

--0016e64807c02bde4e047b73705e
Content-Type: text/plain; charset=ISO-8859-1

Thanks guys for your suggestions. In mean time i have got a good
link describing many situations.

These situations I believe has many takers.

http://httpd.apache.org/docs/2.0/misc/rewriteguide.html

<http://httpd.apache.org/docs/2.0/misc/rewriteguide.html>
Regards,
Vijay Shanker Dubey



On Wed, Dec 23, 2009 at 6:46 AM, Igor Cicimov <icicimov [at] gmail.com> wrote:

> Only this %(HTTP_HOST) should be in curly brackets
>
>
> On Wed, Dec 23, 2009 at 1:51 AM, Oliver Schoenborn <schoenb [at] cae.com>wrote:
>
>> Vijay,
>> If you have a small number of subdomains, I would try, for each one:
>>
>> <virtualhost *:80>
>> ServerName subdomainN.domain.com
>> ProxyRequests off
>> ProxyPass / http://domain.com/key/subdomainN
>> ProxyPassReverse / http://domain.com/key/subdomainN
>> </virtualhost>
>>
>> Otherwise I would try a rewrite rule such as:
>>
>> RewriteCond %(HTTP_HOST) (.+).domain.com
>> RewriteRule ^(.+)$ %(HTTP_HOST)$1 [C]
>> RewriteRule (.+).domain.com(.*) http://domain.com/key/$1$2 [L]
>>
>> The first rule is required so that pattern matching can extract the
>> subdomain name. The condition can be removed if the rewrite rules appear in
>> a vhost.
>>
>> Oliver
>>
>>
>> From: vijay shanker [mailto:vijay.shad [at] gmail.com]
>> Sent: December 22, 2009 4:49 AM
>> To: users [at] httpd.apache.org
>> Subject: [users [at] httpd] URL re-writing problem
>>
>> Hi all,
>>
>> I am very new to httpd server. And i have a immediate problem to solve. My
>> server instance is running on centos box.
>>
>> If a request comes to my server as
>>
>> ----
>> http://sub-domain.domain.com
>> ---
>>
>> This should be translated to
>>
>> ---
>> http://domain.com/key/sub-domain
>> ---
>>
>> I have configured many virtual host on my server. But this is quite a case
>> and i am running out of ideas
>>
>>
>> Any suggestion: what should i do?
>>
>>
>>
>>
>> Regards,
>> Vijay Shanker Dubey
>>
>> ------------------------------------------------------------ ---------
>> The official User-To-User support forum of the Apache HTTP Server Project.
>> See <URL:http://httpd.apache.org/userslist.html> for more info.
>> To unsubscribe, e-mail: users-unsubscribe [at] httpd.apache.org
>> " from the digest: users-digest-unsubscribe [at] httpd.apache.org
>> For additional commands, e-mail: users-help [at] httpd.apache.org
>>
>>
>

--0016e64807c02bde4e047b73705e
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div>Thanks guys for your suggestions. In mean time i have got a good link=
=A0describing=A0many=A0situations.</div><div><br></div><div>These situation=
s I believe has many takers.</div><div><br></div><a href=3D"http://httpd.ap=
ache.org/docs/2.0/misc/rewriteguide.html">http://httpd.apach e.org/docs/2.0/=
misc/rewriteguide.html</a><div>

<br></div><div><div><a href=3D"http://httpd.apache.org/docs/2.0/misc/rewrit=
eguide.html"></a><br clear=3D"all">Regards,<br>Vijay Shanker Dubey<br><br>
<br><br><div class=3D"gmail_quote">On Wed, Dec 23, 2009 at 6:46 AM, Igor Ci=
cimov <span dir=3D"ltr"><<a href=3D"mailto:icicimov [at] gmail.com">icicimov [at] =
gmail.com</a>></span> wrote:<br><blockquote class=3D"gmail_quote" style=
=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Only this %(HTTP_HOST) should be in curly brackets <br><div><div></div><div=
class=3D"h5"><br><br><div class=3D"gmail_quote">On Wed, Dec 23, 2009 at 1:=
51 AM, Oliver Schoenborn <span dir=3D"ltr"><<a href=3D"mailto:schoenb [at] ca=
e.com" target=3D"_blank">schoenb [at] cae.com</a>></span> wrote:<br>


<blockquote class=3D"gmail_quote" style=3D"border-left:1px solid rgb(204, 2=
04, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">Vijay,<br>
If you have a small number of subdomains, I would try, for each one:<br>
<br>
<virtualhost *:80><br>
=A0 =A0ServerName <a href=3D"http://subdomainN.domain.com" target=3D"_blan=
k">subdomainN.domain.com</a><br>
=A0 =A0ProxyRequests off<br>
=A0 =A0ProxyPass =A0 =A0 =A0 =A0 / =A0 <a href=3D"http://domain.com/key/su=
bdomainN" target=3D"_blank">http://domain.com/key/subdomainN</a><br>
=A0 =A0ProxyPassReverse =A0/ =A0 <a href=3D"http://domain.com/key/subdomai=
nN" target=3D"_blank">http://domain.com/key/subdomainN</a><br>
</virtualhost><br>
<br>
Otherwise I would try a rewrite rule such as:<br>
<br>
RewriteCond %(HTTP_HOST) (.+).<a href=3D"http://domain.com" target=3D"_blan=
k">domain.com</a><br>
RewriteRule ^(.+)$ %(HTTP_HOST)$1 =A0 =A0[C]<br>
RewriteRule (.+).<a href=3D"http://domain.com" target=3D"_blank">domain.com=
</a>(.*) <a href=3D"http://domain.com/key/$1$2" target=3D"_blank">http://do=
main.com/key/$1$2</a> =A0 =A0 [L]<br>
<br>
The first rule is required so that pattern matching can extract the subdoma=
in name. The condition can be removed if the rewrite rules appear in a vhos=
t.<br>
<br>
Oliver<br>
<br>
<br>
From: vijay shanker [mailto:<a href=3D"mailto:vijay.shad [at] gmail.com" target=
=3D"_blank">vijay.shad [at] gmail.com</a>]<br>
Sent: December 22, 2009 4:49 AM<br>
To: <a href=3D"mailto:users [at] httpd.apache.org" target=3D"_blank">users [at] httpd=
..apache.org</a><br>
Subject: [users [at] httpd] URL re-writing problem<br>
<div><div></div><div><br>
Hi all,<br>
<br>
I am very new to httpd server. And i have=A0a=A0immediate=A0problem=A0to so=
lve.=A0My server instance is running on centos box.<br>
<br>
If a request comes to my server as<br>
<br>
----<br>
<a href=3D"http://sub-domain.domain.com" target=3D"_blank">http://sub-domai=
n.domain.com</a><br>
---<br>
<br>
This should be translated to=A0<br>
<br>
---<br>
<a href=3D"http://domain.com/key/sub-domain" target=3D"_blank">http://domai=
n.com/key/sub-domain</a><br>
---<br>
<br>
I have configured many virtual host on my server. But this is quite a case =
and i am running out of ideas=A0<br>
<br>
<br>
Any=A0suggestion: what should i do?<br>
<br>
<br>
<br>
<br>
Regards,<br>
Vijay Shanker Dubey<br>
<br>
</div></div><div><div></div><div>------------------------------------------=
---------------------------<br>
The official User-To-User support forum of the Apache HTTP Server Project.<=
br>
See <URL:<a href=3D"http://httpd.apache.org/userslist.html" target=3D"_b=
lank">http://httpd.apache.org/userslist.html</a>> for more info.<br>
To unsubscribe, e-mail: <a href=3D"mailto:users-unsubscribe [at] httpd.apache.or=
g" target=3D"_blank">users-unsubscribe [at] httpd.apache.org</a><br>
=A0 " =A0 from the digest: <a href=3D"mailto:users-digest-unsubscribe=
[at] httpd.apache.org" target=3D"_blank">users-digest-unsubscribe [at] httpd.apache.=
org</a><br>
For additional commands, e-mail: <a href=3D"mailto:users-help [at] httpd.apache.=
org" target=3D"_blank">users-help [at] httpd.apache.org</a><br>
<br>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br></div></div>

--0016e64807c02bde4e047b73705e--
vijay shanker [ Do, 24 Dezember 2009 07:20 ] [ ID #2026997 ]
Webserver » gmane.comp.apache.user » URL re-writing problem

Vorheriges Thema: Searching for a powerfull apache log analizer
Nächstes Thema: Change response status from 403 to 404