CSS文件";未找到";使用默认的Wordpress.htaccess设置


CSS files "not found" with default Wordpress .htaccess settings

我继承了一个Wordpress项目。

我在主题中添加了一个CSS文件(例如extra.css(。

但如果我尝试在浏览器中加载它,如下所示:

http://example.com/wp-content/themes/MyTheme/extra.css

我收到一个"找不到页面"错误。该目录中服务器上的文件IS。

如果我在主题文件夹中创建一个新文件夹,并尝试URL,就像这样:

http://example.com/wp-content/themes/MyTheme/test/test.txt

文本文件加载良好。我不明白为什么ONLY CSS文件不会从文件系统加载。我检查了.htaccess文件,设置是WP默认设置。

那么,在这种情况下,我如何让WP识别新的CSS文件呢?或者这个问题的原因可能是什么?

更新:有两个因素可能会影响这一点:(1(这是一个由cPanel(ugh(管理的虚拟服务器,(2(Wordpress主题是主题融合的Avada,这似乎给网站增加了很多奇怪的膨胀。

.htaccess内容:

# BEGIN custom php.ini PHP54
<IfModule mod_suphp.c>
    suPHP_ConfigPath /home/example/public_html
</IfModule>
# END custom php.ini
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index'.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

您可以将此链接添加到具有正确文件位置的标头中

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

get_template_directory_uri((将进入您的主题转到header.php添加

<link href="http://example.com/wp-content/themes/MyTheme/extra.css" rel="stylesheet" type="text/css" />

内部标题标签所以它将是

<title>
  <link href="http://example.com/wp-content/themes/MyTheme/extra.css" rel="stylesheet" type="text/css" />
</title>