homepage Welcome to WebmasterWorld Guest from 54.226.235.222
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Mod rewrite problems
LiveFlex8




msg:4530183
 4:07 pm on Dec 21, 2012 (gmt 0)

- We have a php app located at www.example.com/go
- We have a vhost and subdomain at go.example.com that points to www.example.com/go
- One of the app resources is /api - this can be called at go.example.com/api with some extra uri segments. Examples: go.example.com/api/reports and go.example.com/api/contacts
- All of the above works 100%

What we would now like to achieve is to instead have 'api' as a subdomain. So, instead of the api root being go.example.com/api, we'd like this to be api.example.com.

1. Do we have to get api.example.com to rewrite to go.example.com/api, or to www.example.com/go/api?

2. What .htaccess rules do we need to set up?

3. Do we need to set up a vhost for api.example.com? If yes, where does this vhost need to point to?


Thanks for any advice you can give.

 

g1smd




msg:4530186
 4:17 pm on Dec 21, 2012 (gmt 0)

1. The rewrite will look for URL requests asking for api.example.com and the rule target will be the internal filename in the server filesystem where the content resides (this target will NOT contain a hostname, this target is an internal target not a URL out there on the web).

2a. You will need an internal rewrite to fulfil requests for api.example.com and it will need to go in the folder wherever those requests resolve to.

2b. You will also need additional rules to redirect requests for www.example.com/api and others to the new URL. Those rules will be in a different htaccess file.

3. How is the go. subdomain set up? You'll need a similar set up for api. subdomain.

In order to get your head round this, you will need to know which things are URLs used "out there" on the web and which things are internal folders and files used "here" inside the server. They are not at all the same thing.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved