Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End All my wordpress links have turned into external links

  • This topic is empty.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #26995
    casiodan
    Participant

    Hi folks,

    I have built a wordpress site and have been using xampp to save time uploading to my web server all the time. Anyway when i have tried to view the site on another pc on my network i have noticed all the links to stylesheets and stuff like jquery have been saved with the full link. For example if i open firebug and look at my stylesheet call it shows as :

    <link media="screen" type="text/css" href="http://localhost/wordpress/wp-content/themes/occasions/style.css&quot; rel="stylesheet">

    Obvioulsy i need it to be relative to the site root rather than the full link as when i upload it to the web its gonna mess things up.

    I know there will be a simple fix for this and im gonna look stupid but i have looked everywhere.

    Im using dreamweaver CS4 for my editing and using the built in file manager to upload to the xampp folder.

    Thanks people

    Dan

    #67295
    TheDoc
    Member

    It’s funny. I had this exact same question the other day, had a look on the web, couldn’t find my answer and gave up. I look for 25 seconds for you, and whamo!

    <?php bloginfo(‘template_directory’); ?>

    #67297
    casiodan
    Participant

    Sorry for being dumb. I know its an old line but im very new to WP. Do i just need to stick that in the head somewhere?

    Thanks for the speedy response

    Dan

    **edit**

    This is what the line looks like in my head section relating to the stylesheet

    <link rel="stylesheet" href="<?php bloginfo(‘stylesheet_url’); ?>" type="text/css" media="screen" />

    #67300
    TheDoc
    Member
    "casiodan" wrote:
    This is what the line looks like in my head section relating to the stylesheet

    <link rel="stylesheet" href="<?php bloginfo(‘stylesheet_url’); ?>" type="text/css" media="screen" />

    That’s exactly what it should look like for you stylesheet, don’t need to change that.

    #67302
    casiodan
    Participant

    OK, so im guessing what your saying is that the <?php bloginfo(‘template_directory’); ?> tells wp how to construct the links and i need to work out how to use it?

    Thanks

    Dan

    #67303
    TheDoc
    Member

    Example using an image:

    <img alt="" src="<?php bloginfo(‘template_directory’); ?>/images/your-image.jpg" />

    The link that it will create will look something like this:

    <img alt="" src="http://www.your-site.com/wp-content/themes/your-theme-name/images/your-image.jpg&quot; />

    #67304
    TeMc
    Member

    OK.

    I’ve had this exact same problem a month ago and it’s got nothing to do with those template_directory-tags !
    Because you seem to be using them already, and it basicly doesn’t matter in most cases.

    The problem, as topicstarter described, is the full links.

    Most likely your links start with localhost (that is, on your local machine). Since WordPress has saved this into it’s "General Settings", and since WordPress always makes full links. Even from another machine, the links will still start with localhost, and thuss fail, since the "another machine" isn’t the same localhost as your own computer.

    To fix this there are several ways.

    The easiest way is to open up wp-config.php and put in the following lines:

    Code:
    define(‘WP_HOME’,’http://example.com&#8217;);
    define(‘WP_SITEURL’,’http://example.com&#8217;);

    Replace example.com with your local LAN IP-address (for example 192.168.178.104).

    Then, no matter from where you are in your network ("LAN"), the site will still work.


    TeMc

    #67307
    TheDoc
    Member

    TeMC, I don’t think that’s the problem that the user is describing. I think they were just concerned that their links were going to be for localhost when the site went live.

    #67309
    casiodan
    Participant

    Ok Guys,

    That has fixed the problem. My other machines were just displaying unstyled WP content because they were looking for localhost/ which obviously only applies to the machine running xampp. I suppose this is just a drawback to using a testing server.

    When i upload this to my web server im guessing the config file will be ok because i will have run a fresh WP install to the server and the links will be pointing to the right place then??

    Thanks for your help.

    Dan

    #69526
    TeMc
    Member

    @casiodan: Yup, that’s how it goes.

    For other users whom may find this, a short tip if you want your site to work in a local network (LAN) or other situation in which the link WordPress is configured in, does not work, or only works from 1 machine (ie. the localhost-issue as described above)

    What you can do is edit wp-config.php and add the following two lines, where "example.com" is the NEW (if not) TEMPORARY domain of your site.

    Code:
    define(‘WP_HOME’,’http://example.com&#8217;);
    define(‘WP_SITEURL’,’http://example.com&#8217;);

    So, if you’re in a local network (LAN) and it’s currently pointing to http://localhost (causing the site to be text-only from other computers) change it to something like 192.168.1.103

    In Windows: Go Start -> Run -> type "cmd" (without "quotes") -> Hit Enter -> type "ipconfig" Hit Enter -> Check "IP Address")
    or;
    in Mac OS X / Unix : Go to Terminal (under Utilities in Applications) and type "ipconfig getifaddr en0" or "ipconfig getifaddr en1") and Press Return; alternativly go to System Preferences -> Network and see your local IP there

    See also: http://codex.wordpress.org/Changing_The … config.php

Viewing 10 posts - 1 through 10 (of 10 total)
  • The forum ‘Back End’ is closed to new topics and replies.