Forum Moderators: phranque

Message Too Old, No Replies

Mod rewrite from subdomain to directory on main

Conv. http://wiki.example.com/sample to http://www.example.com/wiki/sample

         

billuk

1:42 pm on Sep 12, 2007 (gmt 0)

10+ Year Member



Hello,

First I apologise for another mod_rewrite question. I have searched the forum and found some conditions that seem similar to mine, but I don't get it!

Here is my setup:

I currently have a wiki at a sub-domain with directory-esque pages, example:

[wiki.example.com...]
[wiki.example.com...]
[wiki.example.com...]
etc

I want to exactly map any requests from the sub-domain to a directory in the main domain, for example http://www.example.com/wiki.

So the original address of
[wiki.example.com...]
would permanently redirect to
http://www.example.com/wiki/samplepage

and the original address of
[wiki.example.com...]
would permanently redirect to
http://www.example.com/wiki/

and the original address of
[wiki.example.com...]
would permanently redirect to
http://www.example.com/wiki/sample1/sample2/sample3

etc

I think it should be simple but the answer as yet eludes me!

Any help greatly appreciated :)

jdMorgan

1:59 pm on Sep 12, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



See Apache mod_alias [httpd.apache.org], and specifically the RedirectPermanent or Redirect 301 directives.

Note that the part of the local URL-path that you do not specify on the left side will be retained and 'copied' to the end of new URL on the right.

Jim

billuk

7:37 am on Sep 13, 2007 (gmt 0)

10+ Year Member



Thanks jdMorgan, I knew it would/should be something simple. Many thanks :)