WordPress.org

Ready to get started?Download WordPress

Forums

Header images displaying on main page but not on sub pages. Same header file... (4 posts)

  1. Vitorious
    Member
    Posted 6 years ago #

    http://www.vitorious.net/exilebooks/en/

    I am working on putting this site on my server. The original code was written as if the site is the only one on the server, "/images" was in a few spots. Ive had to go through and change some code as it is one of a few sites I have on my server and located in a sub directory.

    I have modified the header file and it started working on the main page. However if you click any of the main navigation links on the left sidebar (About Us for example) the images are broken.

    I have looked at the source thats outputted for both sites and even copy and pasted the image links into a text file to make sure they are identical (they are).

    How is this possible? It might just be because its late but im at wits end.

    Any ideas?

    Thanks in advance for any help thats offered.
    -Jordan

  2. mrmist
    Forum Janitor
    Posted 6 years ago #

    I *think* I see the problem, but I'm not certain because I don't know how much of your layout is virtual.

    Anyway, the URL for your images is relative, and in both cases (main page and about page) is

    img src="../images/logo.gif

    So since your about page is in a directory level further down, your link points to the wrong place.

    You'd either have to add a layer of upwards direction to your about us page

    img src="../../images/logo.gif

    Or, better, I think, make it a more site-absolute link and use

    img src="/images/logo.gif

    which should work regardless.

    Don't believe that this has much to do with WordPress per se.

  3. whooami
    Member
    Posted 6 years ago #

    mrmist is right.

    Just use the absolute url to the image, and that will solve the problem regardless of the page you are on.

    .

  4. Vitorious
    Member
    Posted 6 years ago #

    Thanks guys! I thought that might have been the problem, but then I thought it wasnt because the directorys are virtual (permalinks) but the browser doesnt know that.

    I wasnt sure what to do as the site was located in a sub directory and /images would source the main sites images. Not exilebooks/images. And since im switching the domain I dint want to hard code the directory in there.

    So what I did was create a sub domain to point to /exilebooks/ which solved the problem.

    I know you would know all this but just in case someone is searching for the same problem they have a complete answer.

    Thanks again.
    -Jordan

Topic Closed

This topic has been closed to new replies.

About this Topic