Forum Moderators: phranque

Message Too Old, No Replies

Mapping subfolder to actual content

mysite.com/forums should show contents of forums.mysite.com

         

max_1986

3:04 pm on Jul 24, 2010 (gmt 0)

10+ Year Member



Hi,

We have recently had to move our forums onto a different server to the rest of the site and have set these up at forums.mysite.com

However, we want users to be able to go to mysite.com/forums and use the forums. So essentially I think we are mapping the contents of forums.mysite.com to make it appear like it's at mysite.com/forums

How do I do this please?

Many thanks,

Max

jdMorgan

4:18 pm on Jul 24, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Why do that, though?

It would be better to simply map the URL "forum.example.com" to the server-internal filepath "/forum" and link to the forum pages only at forum.example.com/page

There is no benefit or need to to make the URL indicate that the forum is located in some subdirectory -- The users and search engines certainly don't care, and it only makes the URLs longer.

The generally-recommended method is to link only to "forum.example.com" without including the /forum subdirectory path, to internally rewrite requests for forum.example.com to the correct filepath inside the server, and to externally redirect any client requests that contain that internal filepath back to the correct subdomain base URL. (This latter step is only needed if the internal filepath has been previously accidentally exposed to clients.)

It's not clear what the actual requirements are here. What is the goal? Where do you want/intend to put this URL-redirection/rewriting code? What are the forum URLs currently published on the Web? More details, please...

It's always a really good idea to get a solid requirements specification before commencing the coding... :) We can easily provide an exquisitely-correct solution to the utterly-wrong problem here, with disastrous results for your site/traffic/revenue... :o

Jim

max_1986

4:59 pm on Jul 24, 2010 (gmt 0)

10+ Year Member



Hi Jim,

Thanks for getting back to me so quickly and good questions. The reason we want to have it look like it's at a subfolder (mysite.com/forums) is because the forums are currently there now - so I guess my answer is that the decision is for consistency reasons alone.

Cheers,

Max

jdMorgan

5:23 pm on Jul 24, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



OK, but it will be necessary for the forum pages to link to --and include objects from-- only forums.example.com. Otherwise, you set up the situation where *every* request for any forum page or object would have to 'pass through' example.com/forum/ and get redirected to forum.example.com/

This would mean that every HTTP request would result in a second HTTP request -- the first to example.com/forum/ which would get redirected, and the second to forum.example.com/

Both servers would log requests -- the example.com serer would log all the redirect responses, and the forum.example.com server would log all the just-now-redirected page requests.

---

To avoid changing the URLs seen by search engine robots and by users, you'd have to reverse-proxy example.com/forum to forum.example.com
Again, we have the situation where the requests have to pass through the example.com server. But now instead of redirecting the client, this server will open its own HTTP connection to forum.example.com, get the response, and then pass that back to the requesting client. So instead of simply providing a redirect response as in the above implementation, the example.com server now also has to handle the content.

Also, in order for the two servers' logs to be useful, you need to use custom logging on both of them: example.com needs to be set up to NOT log requests for example.com/forum, and to pass the X-Forwarded-For header to the forum.example.com server, where it should be used (again in a custom logging configuration) instead of the 'usual' Remote_Address entry in the log files. Otherwise, the forum.example.com server will always see the example.com server as the client.

---

The third choice is to change all links on forum.example.com to point to forum.example.com, and then 301-redirect all client requests for example.com/forum to forum.example.com

This will result in the URLs shown in search results and in the visitors' browser address bars changing to forum.example.com

And in order to minimize the amount of wasted HTTP transactions over time, you will want to ask of of your major linking partners to stop linking to example.com/forum and start linking to forum.example.com

So, which approach sounds best/least-painful to you?

Jim

max_1986

1:19 pm on Aug 2, 2010 (gmt 0)

10+ Year Member



Thanks very much for that! Sorry for the delay in getting back to you!

Good points, will have a think about best solution. Nice one, cheers!