Top VPS Hosting Provider

Welcome to the myhosting.com Forums.
+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2012
    Posts
    1

    Default Domain going to subfolder can't see CSS files

    I have an "ecommerce" shared hosting account and my site is setup for Windows.

    My setup has folders something like this:

    wwwroot
    css
    graphics
    folder1

    My primary website is at the root and has its own domain ie. www.primarydomain.com

    I have another domain that I want to use to take users directly to the part of the site they need and it is directed to wwwroot/folder1 where there is a default.htm that is displayed. Let's call that domain www.seconddomain.com At the moment, none of the images appear and the css isn't being used. The links are in the form "../css/standard.css" or "../images/image1.jpg".

    I assume that they don't work since the www.seconddomain.com points directly to the folder & I assume is unable to "see" the folders that are at the same hierarchy level.

    Is there any way around this? I really don't want to duplicate CSS files and image files under folder1 and I'm not too thrilled with the idea of editing all the links in the files under folder1 to hardcode www.primarydomain.com into each and every one. I created & maintain the site using ExpressionWeb and much of this code is in my Dynamic Web Template - to change just this section of the site would require using a separate template for that area and negates a lot of the advantages of using it in the first place (primarily only having to make changes to 1 file to update the whole site.) There is also the problem that most of the pages www.seconddomain.com/default.htm uses are ALSO used by the main site at www.primarydomain.com, so whatever solution I come up with can't break the pages when reached that way.

    Is it time for me to delve into the mysteries of web.config? Is it possible to use that to redirect any calls to seconddomain.com for *.css or *.jpg to be redirected to the correct location? I'll take the time to research and learn about it if it will solve the problem, but I sure don't want to make that effort just to find out it won't do what I need. Any other ideas out there?

  2. #2
    jeremya is offline Administrator
    Join Date
    Jun 2008
    Posts
    270

    Default

    I suspect this is a result of using virtual directories. You definitely won't be able to access files that are outside of the document root for the application.

    I'm not sure there's anyway around a change of some sort along the lines you've suggested. Generally separate domains / sites have to be treated separately.
    -Jeremya

  3. #3
    tima is offline Administrator
    Join Date
    Apr 2008
    Posts
    191

    Default

    I've tested out Jeremy's theory and have confirmed.

    I have the following directory structure:

    Code:
    wwwroot
       |- folder
              |- root
    I've placed photo.jpg in /wwwroot, and index.html in /wwroot/folder/root which calls "../../photo.jpg"

    DomainA.com has it's root set as /wwwroot
    DomainB.com has it's root set as /wwwroot/folder/root

    When you open DomainA.com/folder/root/index.html in a browser everything displays fine.
    When you open DomainB.com/index.html (same file) in a browser, the image does not display.

    So if you want to call files or images below the root of DomainB.com, you'll need to call them via DomainA.com.

    Here's an idea though...

    Code:
    wwwroot (root for Domain1.com)
       |- folder2 (root for Domain2.com)
               |- folder3 (root for Domain3.com)
                      |- images
    If you place your files within /wwwroot/folder2/folder3/images, Domain1.com, Domain2.com and Domain3.com will all be able to access them.
    Tim Attwood
    Product Manager
    myhosting.com


 

Similar Threads

  1. Css 3
    By silkysmooth in forum How-To
    Replies: 2
    Last Post: 2012-06-27, 07:39 AM
  2. CSS for website layouts
    By Texas2Step in forum Programming
    Replies: 1
    Last Post: 2011-09-22, 12:24 AM
  3. changing css in Joomla
    By laurelclark in forum Troubleshooting
    Replies: 2
    Last Post: 2011-03-29, 07:37 AM
  4. Xhtml/css
    By Randy5 in forum Programming
    Replies: 1
    Last Post: 2011-01-26, 11:35 AM
  5. Upload website to a subfolder of Root
    By momsoft in forum Beginners
    Replies: 2
    Last Post: 2009-06-17, 03:58 AM

Posting Permissions

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