Forum Moderators: phranque

Message Too Old, No Replies

Subdomain using mod rewite

         

Gian04

1:16 am on Sep 30, 2008 (gmt 0)

10+ Year Member



is it possible that when a visitor typed in
http://www.my-sub-folder.example.com
on their browser's address bar, it will get / retrieve the contents of the page from
http://www.example.com/my-sub-folder
(but the address bar will remain as is (
http://www.my-sub-folder.example.com
)?

How about this one?

http://www.member-name.example.com
retrieved from
http://www.example.com?var=member-name

[edited by: Gian04 at 1:23 am (utc) on Sep. 30, 2008]

jdMorgan

3:29 pm on Sep 30, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, try a search of this forum (see link at top of this page) for "rewrite subdomain subdirectory rewritecond http_host rewriterule" for many examples.

The distinction you're looking for with "address bar will remain" is that you want an internal (URL-to-filepath) rewrite, and not an external (URL-to-URL) redirect.

Jim

jdMorgan

3:33 pm on Sep 30, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



... and discussion of your second example with the subdomain being rewritten to a script with a query string can be found with "rewrite subdomain script rewritecond http_host rewriterule" or similar.

The threads that turn up will likely be helpful to get you started. Modify the code to suit your needs, test, and if any problems, post specific questions back here.

Jim

g1smd

3:53 pm on Sep 30, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I posted a detailed example of something very close to this about three or four times over the last few weeks.

Last time was only a couple of days ago.