此处需要有关apache httpd
重写规则的帮助。
问题在于使用multisite
配置wordpress
。我们能够使用extended URL
的基于路径的多站点功能成功创建wordpress
。扩展的URL是
http://www.example.com.au/support/
extended URL
的问题在于加载CSS/Java Scripts
时未加载extended URL
。这就是为什么用户界面extended URL
看起来很糟糕的原因。看起来它无法加载CSS/Java
脚本可用的文件。我从访问日志文件的内容告诉我,如下所示。
10.200.64.39 "-" - - [02/Nov/2015:00:29:37 +1100] "GET /support/wp-content/themes/twentyfifteen/js/functions.js?ver=20150330 HTTP/1.1" 404 9402 "http://www.example.com.au/support/wp-admin/" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0" 39020 "-" "Cookies:wordpress_test_cookie=WP+Cookie+check;
以下文件显示404 not found
GET /support/wp-content/themes/twentyfifteen/js/functions.js?ver=20150330 HTTP/1.1"
$ ls -l /support/wp-content/themes/twentyfifteen/js/functions.js
ls: cannot access /support/wp-content/themes/twentyfifteen/js/functions.js: No such file or directory
$ ls -l wp-content/themes/twentyfifteen/js/functions.js
-rwxrwxrwx 1 nobody admin 5899 Jul 30 04:13 wp-content/themes /twentyfifteen/js/functions.js`
$ pwd
/data/share/web/marketing/digitalsol
$ ls -ld wp-content/ wp-includes/ wp-admin/
drwxrwsrwx 9 nobody admin 4096 Sep 16 00:58 wp-admin/
drwxrwsrwx 5 nobody admin 4096 Oct 30 22:13 wp-content/
drwxrwsrwx 12 nobody admin 4096 Sep 16 00:58 wp-includes/
扩展URL的问题是支持目录,它是extended URL
的一部分,但该目录在系统上并不存在。
因此,我们可能需要修改rewrite
规则,以便它可以在CSS/javascript
中加载extended URL
。下面显示的是当前可用的重写规则。
$ cat .htaccess
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
请在解决问题时建议
答案 0 :(得分:0)
在apache配置文件中,我们启用了wp_security.conf
。此配置文件包含从ALL拒绝.htaccess
的ACL。在评论ACL条目时,CSS / JS在扩展的多站点URL中正常加载。