$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>theme development - Style.css redirects to 404 Page not found|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

theme development - Style.css redirects to 404 Page not found

matteradmin8PV0评论

I've just uploaded a wordpress site from MAMP to a live site. Exactly the same methods I usually use to upload them, including permalinks and all the usual PHPMyAdmin bits.

This time the style.css, js and all the images are just redirecting to a 404 page.

The website is here

Can anyone help? This makes no sense at all.

EDIT: heres a snippit of header.php:

<!DOCTYPE html>
<html lang='en'>
    <head>
        <!-- Version 1.0 of Ken Christys Rural Support Website -->
        <meta charset="utf-8">
        <meta content='width=device-width, initial-scale=1.0' name='viewport'>
        <meta content='Josh Stevens, Lyndsay Hooper, PotatoMou.se' name='author'>
        <meta content='<?php bloginfo( 'description' ); ?> ' name='description'>
        <meta content='' name='keywords'> 
        <script>
            if(!window.jQuery)
                {
                     var script = document.createElement('script');
                     script.type = "text/javascript";
                     script.src = ".1.0/jquery.min.js";
                     document.getElementsByTagName('head')[0].appendChild(script);
                }
        </script>


        <!-- Google Analytics-->

        <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/javascript/pace.js"></script>
        <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />

        <title>
            <?php echo get_the_title() . "  -  ". get_bloginfo ( 'description' );  ?><br />
            <!-- Current Page title - Website description -->
        </title>



    </head>

and here is the actual rendered code:

<!---->
<!DOCTYPE html>
    <html lang='en'>
    <head>
        <!-- Version 1.0 of Ken Christys Rural Support Website -->
        <meta charset="utf-8">
        <meta content='width=device-width, initial-scale=1.0' name='viewport'>
        <meta content='Josh Stevens, Lyndsay Hooper, PotatoMou.se' name='author'>
        <meta content='Ken Christy Rural Support ' name='description'>
        <meta content='' name='keywords'> 
        <script>
            if(!window.jQuery)
                {
                     var script = document.createElement('script');
                     script.type = "text/javascript";
                     script.src = ".1.0/jquery.min.js";
                     document.getElementsByTagName('head')[0].appendChild(script);
                }
        </script>


        <!-- Google Analytics-->

        <script type="text/javascript" src=".js"></script>
        <link rel="stylesheet" type="text/css" media="all" href=".css" />

        <title>
            Home  -  Ken Christy Rural Support<br />
            <!-- Current Page title - Website description -->
        </title>

I've just uploaded a wordpress site from MAMP to a live site. Exactly the same methods I usually use to upload them, including permalinks and all the usual PHPMyAdmin bits.

This time the style.css, js and all the images are just redirecting to a 404 page.

The website is here

Can anyone help? This makes no sense at all.

EDIT: heres a snippit of header.php:

<!DOCTYPE html>
<html lang='en'>
    <head>
        <!-- Version 1.0 of Ken Christys Rural Support Website -->
        <meta charset="utf-8">
        <meta content='width=device-width, initial-scale=1.0' name='viewport'>
        <meta content='Josh Stevens, Lyndsay Hooper, PotatoMou.se' name='author'>
        <meta content='<?php bloginfo( 'description' ); ?> ' name='description'>
        <meta content='' name='keywords'> 
        <script>
            if(!window.jQuery)
                {
                     var script = document.createElement('script');
                     script.type = "text/javascript";
                     script.src = "http://ajax.googleapis/ajax/libs/jquery/2.1.0/jquery.min.js";
                     document.getElementsByTagName('head')[0].appendChild(script);
                }
        </script>


        <!-- Google Analytics-->

        <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/javascript/pace.js"></script>
        <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />

        <title>
            <?php echo get_the_title() . "  -  ". get_bloginfo ( 'description' );  ?><br />
            <!-- Current Page title - Website description -->
        </title>



    </head>

and here is the actual rendered code:

<!---->
<!DOCTYPE html>
    <html lang='en'>
    <head>
        <!-- Version 1.0 of Ken Christys Rural Support Website -->
        <meta charset="utf-8">
        <meta content='width=device-width, initial-scale=1.0' name='viewport'>
        <meta content='Josh Stevens, Lyndsay Hooper, PotatoMou.se' name='author'>
        <meta content='Ken Christy Rural Support ' name='description'>
        <meta content='' name='keywords'> 
        <script>
            if(!window.jQuery)
                {
                     var script = document.createElement('script');
                     script.type = "text/javascript";
                     script.src = "http://ajax.googleapis/ajax/libs/jquery/2.1.0/jquery.min.js";
                     document.getElementsByTagName('head')[0].appendChild(script);
                }
        </script>


        <!-- Google Analytics-->

        <script type="text/javascript" src="http://www.kenchristy-ruralsupport/wp-content/themes/KenChristy/javascript/pace.js"></script>
        <link rel="stylesheet" type="text/css" media="all" href="http://www.kenchristy-ruralsupport/wp-content/themes/KenChristy/style.css" />

        <title>
            Home  -  Ken Christy Rural Support<br />
            <!-- Current Page title - Website description -->
        </title>
Share Improve this question edited Apr 21, 2014 at 17:34 Josh asked Apr 21, 2014 at 16:44 JoshJosh 731 gold badge1 silver badge11 bronze badges 17
  • Did you flush your permalinks? – Pieter Goosen Commented Apr 21, 2014 at 16:49
  • Yes, as I mentioned originally, I've done all the usual bits. – Josh Commented Apr 21, 2014 at 16:50
  • What code is actually outputting the stylesheet that is returning the 404? Please post the relevant code from header.php or functions.php. – Chip Bennett Commented Apr 21, 2014 at 16:56
  • header.php - <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/javascript/pace.js"></script> <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" /> – Josh Commented Apr 21, 2014 at 16:57
  • 1 As @PieterGoosen said: please edit your question to include the code that produces the output, as well as the actual output rendered by that code. – Chip Bennett Commented Apr 21, 2014 at 17:16
 |  Show 12 more comments

4 Answers 4

Reset to default 6

Your directory permissions for your Theme directory are incorrect.

  • wp-content: 0755
  • wp-content/themes: 0755
  • wp-content/themes/kenchristy: 0700

Per the Codex, folder permissions should be set to 755:

In such an suexec configuration, the correct permissions scheme is simple to understand.

  • All files should be owned by the actual user's account, not the user account used for the httpd process.
  • Group ownership is irrelevant, unless there's specific group requirements for the web-server process permissions checking. This is not usually the case.
  • All directories should be 755 or 750.
  • All files should be 644 or 640. Exception: wp-config.php should be 600 to prevent other users on the server from reading it.
  • No directories should ever be given 777, even upload directories. Since the php process is running as the owner of the files, it gets the owners permissions and can write to even a 755 directory.

So, try changing wp-content/themes/kenchristy/ from 0700 to 0755.

replace

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

with

 <link rel="stylesheet" type="text/css" href="<?php echo get_stylesheet_uri(); ?>" />

also try placing your style above all your JS

Your call to wp_head between <head></head> is missing. Just before </head> add <?php wp_head(); ?>Then, enqueue your scripts and stylesheets properly in your functions.php. Have a look at the following from the codex

wp_enqueue_scripts wp_enqueue_style() wp_enqueue_script()

I had a folder named /CSS but was referencing /css in my enqueue. This was no problem on local, but the URLs were case sensitive when I pushed it up to hosting

Post a comment

comment list (0)

  1. No comments so far