Jump to content

Relative URL's

Guest thetakerfan

Recommended Posts

I was trying to create a main page for my site using the IPB wrapper and skins, but right away ran in to a problem with many URLs being relative to the IPB root, and therefor not working outside of it

So basically, if your forums are forums.domain.com, and want to use www.domain.com as your main site, using the IPB skins is kind of a problem.

Just as good design practice, shouldn't the URLs all be fully qualified to begin with anyway?

Link to comment
Share on other sites

um, doesn't it make it less portable?

If your forums are


so your jscript for example is in


If you are making a page on


the relative links to


don't work becuase they aren't where the browser things they are.

http://forums.domain.com/jscripts/whatever.js should obviously be a lot better...

Link to comment
Share on other sites

Relative urls aren't too useful for users like yourself trying to use the css outside of IPB, however, it is more optimized from what I have read, in that it causes the server to look for the images locally to serve, instead of making an http request to pull the images.

i.e. if you look in your apache access logs, if you have full urls for the images you'll see a request for each image on your board just for one page load. That could be what 30 http requests to your server for one page load. With relative paths for the images, you get one request (the actual user requesting the page). :)

Link to comment
Share on other sites

OH! I see what you mean with the shared code :) I have shared css and other code across 5 subdomains with the code stored on the main WWW.

Redirect /includes http://www.domain.com/includes

Redirect /code http://www.domain.com/code

It's not the best way, but it gets it done. My CSS is in code and my template files for the wrapper page is in includes.

In your case, have the .htaccess on your WWW root and put in Redirect /jscript http://forums.domain.com/jscript and that should work :) Or, you know, hard code it on the WWW side.

Link to comment
Share on other sites

Yeah, the workaround you posted is actually pretty smooth work. Should get the job done. :D

Another thing about the relative urls that bugs me a little (trade-offs, eh) is that if you mod IPB to display error pages (using .htaccess to set the ErrorDocuments to something in IPB), if it's like /some/invalid/path of course the images won't show then either. >.<

Link to comment
Share on other sites

I had actually just used a str_replace to change the jscripts and image links to use the full URL, but the htaccess way is a heck of a lot better, I'll change it to that way later.

The reasoning makes perfect sense too bfarber, hadn't thought of it (not that it ever would have occured to me anyway, lol)

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...