Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress url资源返回404_Wordpress_.htaccess_Url_Virtualhost_Permalinks - Fatal编程技术网

Wordpress url资源返回404

Wordpress url资源返回404,wordpress,.htaccess,url,virtualhost,permalinks,Wordpress,.htaccess,Url,Virtualhost,Permalinks,我对wordpress中的资源URL有问题 在索引页面中,正确调用了我的css资源、js和图像: wp content/themes/focus template/js/lib/jquery.min.js 但在帖子详细信息页面上,帖子的名称被添加到URL中: myDomain.com/projet-2012/wp-content/themes/focus-template/js/lib/jquery.mixitup.min.js 404(未找到) 我认为我的虚拟主机配置错误,但我找不到问题出在哪

我对wordpress中的资源URL有问题

在索引页面中,正确调用了我的css资源、js和图像:

wp content/themes/focus template/js/lib/jquery.min.js

但在帖子详细信息页面上,帖子的名称被添加到URL中:

myDomain.com/projet-2012/wp-content/themes/focus-template/js/lib/jquery.mixitup.min.js 404(未找到)

我认为我的虚拟主机配置错误,但我找不到问题出在哪里

<VirtualHost *:80>
ServerName local.afric-edu.com
DocumentRoot /var/www/afric-edu/
ErrorLog /var/log/apache2/errors.log
 <Directory "/var/www/afric-edu">
    AddDefaultCharset UTF-8

DirectoryIndex index.php index.html
RewriteEngine On
RewriteBase /
AddType image/gif .gif
AddType image/ief .ief
AddType image/jpeg .jpeg .jpg .jpe
AddType image/png .png

  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !^.*\.(jpe?g|png|gif|css|js)$ [NC]
  RewriteRule . /index.php [L]
  Order allow,deny
  Allow from all
  AllowOverride All
  </Directory>
</VirtualHost>

ServerName local.afric-edu.com
DocumentRoot/var/www/afric-edu/
ErrorLog/var/log/apache2/errors.log
AddDefaultCharset UTF-8
DirectoryIndex.php index.html
重新启动发动机
重写基/
AddType image/gif.gif
AddType image/ief.ief
AddType image/jpeg.jpeg.jpg.jpe
AddType image/png.png
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写条件%{REQUEST_URI}!^.*\。(jpe?g | png | gif | css | js)$[NC]
重写规则/index.php[L]
命令允许,拒绝
通融
允许超越所有
编辑:

以这种方式调用资源:

<head>
    <meta charset="utf-8">
    <meta name="robots" content="index, nofollow">
    <meta name="description" content="Your website description here">
    <meta name="keywords" content="your, website, keywords, here">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="viewport" content="width=device-width">

    <link rel="shortcut icon" href="../images/favicon/favicon.ico">

    <title><?php wp_title( '|', true, 'right' ); ?></title>
    <link rel="profile" href="http://gmpg.org/xfn/11">
    <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
    <script type="text/javascript" src="wp-content/themes/focus-template/js/lib/jquery.min.js"></script>
    <script type="text/javascript" src="wp-content/themes/focus-template/js/lib/modernizr.js"></script>
    <script type="text/javascript" src="wp-content/themes/focus-template/js/lib/pace.js"></script>
    <script type="text/javascript" src="wp-content/themes/focus-template/js/lib/classie.js"></script>
    <script type="text/javascript" src="wp-content/themes/focus-template/js/lib/jquery.fittext.js"></script>
    <script type="text/javascript" src="wp-content/themes/focus-template/js/lib/jquery.magnific-popup.min.js"></script>
    <script type="text/javascript" src="wp-content/themes/focus-template/js/lib/jquery.mixitup.min.js"></script>
    <script type="text/javascript" src="wp-content/themes/focus-template/js/lib/jquery.sudoslider.min.js"></script>
    <script type="text/javascript" src="wp-content/themes/focus-template/js/lib/jquery.superslides.min.js"></script>
    <script type="text/javascript" src="wp-content/themes/focus-template/js/lib/smoothscroll.js"></script>



    <link rel="stylesheet" href="wp-content/themes/focus-template/css/lib/font-awesome.min.css">
    <link rel="stylesheet" href="wp-content/themes/focus-template/css/lib/magnific-popup.css">
    <link rel="stylesheet" href="wp-content/themes/focus-template/css/lib/lite.css">
    <link rel="stylesheet" href="wp-content/themes/focus-template/css/style.css">
    <link rel="stylesheet" href="wp-content/themes/focus-template/css/colors/yellow.css">
    <link rel="stylesheet" href="wp-content/themes/focus-template/genericons/genericons.css">



    <!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <?php wp_head(); ?>
</head>


您不应该链接到这样的资源,而应该使用以下内容:

<script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/js/lib/jquery.min.js"></script>

@RhysStewart我是手工做的。我在编辑中添加了代码。是的,url现在可以了!谢谢你:)