Can't link to css on local host

I have wordpress running on WAMP and I am able to pull up the page with the custom template, but for some reason the css won’t load. When I veiw the page source I get an error message that says,

<title>404 Not Found</title>
<h1>Not Found</h1>
<p>The requested URL /wordpress/css/style.css was not found on this server.</p>

I don’t know how the path isn’t correct since I created the path using the “Attach Style Sheet” link button in Dreamweaver.

What could be wrong?

I just got it to work doing this

<link href=“http://localhost/wordpress/wp-content/themes/BLANK-Theme/css/style.css” rel=“stylesheet” type=“text/css”>

However, I don’t get why the first link doesn’t work?

What was it?

Oh, sorry i guess I did forget the original.

<link href=“css/style.css” rel=“stylesheet” type=“text/css”>

To refer a css with relative path you need to add stylesheet directory or theme directory link before the css

You can read details here :


<link href="http://localhost/wordpress/wp-content/themes/BLANK-Theme/css/style.css" rel="stylesheet" type="text/css">

works because it’s always pointing to the same place, while this—

<link href="css/style.css" rel="stylesheet" type="text/css">

most likely is never pointing to the right place, because it would have to be on a page inside the same folder as the /css/ folder. If you don’t want the the full URL, you could try this:

<link href="/wordpress/wp-content/themes/BLANK-Theme/css/style.css" rel="stylesheet" type="text/css">

Well, I knew that it was pointing to an absolute place with “http//:…” but I didn’t know that you have to use stylesheet directory or theme directory to refer to css using a relative path. thx

So, I looked at the linked which you provided me with and I got this to work PARTIALLY

<link href=“<?php echo get_stylesheet_uri(); ?>” rel=“stylesheet” type=“text/css”> which output this link


The problem is that I had to take my style sheet out of the css folder.

However, what I would like is this link output


hello there,

so in this Case use :

<link href=“<?php echo get_template_directory_uri(); ?>/css/style.css” rel=“stylesheet” type=“text/css”>


Thanks. I actually tried this earlier

<link href=“<?php echo get_stylesheet_uri(); ?>/css/style.css” rel=“stylesheet” type=“text/css”> which led to the output of this

<link href=“http://localhost/wordpress/wp-content/themes/Connect4/style.css/css/style.css” rel=“stylesheet” type=“text/css”>

which obviously is wrong.

ok, so try this now :

<link href=“<?php wp_enqueue_style( ); ?>/css/style.css” rel=“stylesheet” type=“text/css”>

Open Function.php of your theme and add this :

function my_styles_method() {  
    // Register the style like this for a theme:  
    wp_register_style( 'my-custom-style', get_template_directory_uri().'/css/style.css');  

    // enqueue the stule  
    wp_enqueue_style( 'my-custom-style' );  
add_action( 'wp_enqueue_scripts', 'my_styles_method' ); 

To learn more about wp_enqueue_style : Link

Try this and it should work

<?php echo get_bloginfo ( 'stylesheet_directory' ); ?>

So now your code would be

<link href="<?php echo get_bloginfo ( 'stylesheet_directory' ); ?>/css/style.css" rel="stylesheet" type="text/css">

Oh, sorry deadmix’s initial response solved my problem. I was just saying that my first method didn’t solve the problem.