SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Sep 2002
    Location
    W. Vancouver
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Forcing to view folder contents through a subdomain?

    Howdy

    Wondering if anyone knows of some javascript that will help me here...

    I have a folder on my site, let's call it http://domain.com/folder/.

    I also have a subdomain called http://folder.domain.com/ which displays content from http://domain.com/folder/.

    Since I'm calling my links relative to the root, when someone visits http://domain.com/folder/, none of the links work.

    Thus, I'm wondering if there's some javascript that can assess the contents of the location bar and redirect or force users (viewing the folder directly) over to the subdomain, thereby correcting all the links.

    I know I can move the contents of the folder and then pop in a meta refresh to the new location but I don't really want to reconfigure the contents of the folder's scripts so I wanted to see if there's a javascript solution to my problem. Search engines (ie redirections being a bad thing) are not an issue here as it's a private site.

    Hope that's clear, any ideas?

  2. #2
    SitePoint Member
    Join Date
    Apr 2004
    Location
    Germany
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could use a javascript command like 'document.location' or 'location.href' that will return a variable to find out what your URL is, and then based on that, re-direct as appropriate.

    I'm not 100% sure it would work with subdomains, though, but it should be worth trying out.
    PAAL Group Recycling Equipment :
    Manufacturer of waste management equipment including
    Industrial Balers, Industrial Compactors
    Industrial Shredders, and Industrial Conveyors.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •