Give help. Get help.

  • # March 15, 2013 at 1:57 pm


    I have an issue with a site I just launched, that didn’t occur to me until I launched it… they have two domain names, the main domain, and an abbreviated domain name which is parked.

    In the parked domain version, the page links are now broken, because they’re looking for the primary domain.

    My question is, is there a solution to this using a Base URL, or, should I be using another technique in JS/jQuery.

    I don’t think the topic requires a code or link example, it’s essentially a question of best practices.

    Please throw in your two cents, I’m struggling to find a straight answer online.


    # March 15, 2013 at 2:07 pm

    You shouldn’t even need to use the base URL in your call if it’s all local. Wouldn’t you just need to go `/other/page`?

    # March 20, 2013 at 7:48 am

    Hi @thedoc, thanks, the issue is that if I use relative URL’s, the links break as soon as I want to link back to the home or any other top level page from “/other/page”, if the href looks like “../home/”, then the site takes you back to one level below the base URL, as per the example below:

    http://localhost/mysite/home/ becomes http://localhost/home/ and breaks for obvious reasons.

    I need the site to work on multiple domains, and with JS switched off. BASE URL causes issues on multiple domains, and relative URL’s cause issues in my current configuration of AJAX.

    A possible solution would be to find all href’s with a leading ‘../’, and remove it. Is that possible?

    # March 26, 2013 at 5:01 am

    Hi @thedoc and anyone else who’s interested, I’ve finally gotten to the bottom of my issue, and I’m embarrassed to say that it’s a real head slapper!! So, I thought I should share it in case someone else has a similar issue.

    The whole issue was based on porting a site from my localhost development environment to the live environment, without needing to replace/update links and URLs when uploading files.

    The long story short is, setup your localhost correctly, and use virtual hosts for subdomains.

    I have been using Mamp for ages now, but I never bothered to delve deep enough into setting up subdomains, so my development sites have always been something along the lines of http://localhost/mysite, instead of http://mysite.localhost.

    Once setup correctly, root relative URL’s work perfectly (instead of taking you back to the localhost root directory).

    I did however manage to solve my question above with the help of @Podders on another thread if anyone is looking for a similar solution for anything:

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.