简体   繁体   English

CSS / JavaScript测试问题

[英]CSS/Javascript Testing Issues

Okay, this is a little lengthy, but here's the issue... 好的,这有点冗长,但这是问题所在...

I am testing an Apache 2.4.3 webserver, running PHP 5.4.11 and I'm running into issues on some pages displaying the css menu and javascript. 我正在测试运行PHP 5.4.11的Apache 2.4.3网络服务器,并且在显示css菜单和javascript的某些页面上遇到了问题。 Let me say that I am not the webpage designer, just the server minion... The developer has used both absolute paths, and relative paths on different pages to call the css and javascript. 让我说我不是网页设计者,而不仅仅是服务器奴才……开发人员使用了绝对路径和不同页面上的相对路径来调用css和javascript。 When testing, the pages that use the absolute path do not display the css menu, nor run the javascript, but the pages with relative paths do. 测试时,使用绝对路径的页面不会显示css菜单,也不会运行javascript,但是具有相对路径的页面会显示。 To possibly complicate matters, I am running two name based virtual hosts on the server, the issue only manifesting itself only on Domain1, the secondary domain doesn't utilize these features. 使事情复杂化的是,我在服务器上运行了两个基于名称的虚拟主机,该问题仅在Domain1上表现出来,辅助域未利用这些功能。 When testing it happens when I am on the server using the localhost, or from a laptop with the domains defined in the host file. 在测试时,它发生在我使用本地主机的服务器上,或者是在主机文件中定义了域的笔记本电脑上。 I'm not sure if it is an issue with the way I am testing the site, or the configuration of the site, or a combination of the two. 我不确定我测试网站的方式,网站的配置或两者的组合是否有问题。 The css calls, and configuration files are as follows: css调用和配置文件如下:


css call from webpage that works: 从有效的网页进行CSS调用:

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

file is located: Document Root/domain1/Folder1/index.php 文件位于:Document Root / domain1 / Folder1 / index.php


css call from webpage that doesn't work: 来自网页的CSS调用无效:

<link href="http://www.domain1/css/cu.css" rel="stylesheet" type="text/css"/>
<script src="AC_RunActiveContent.js" type="text/javascript"></script> <style type="text/css">

file is located: Document Root/domain1/index.php (domain1 main webpage) 文件位于:Document Root / domain1 / index.php(domain1主网页)


httpd-vhost.conf: 的httpd-vhost.conf:

<VirtualHost *:80>

ServerName www.domain1.com
DocumentRoot "/Document Root/domain1"
ServerAdmin admin@domain1.com
ScriptAlias /cgi-bin /Server Root/cgi-bin/
ErrorDocument 404 /domain1/error/404.php
ErrorLog logs/domain1-error_log
CustomLog logs/domain1-access_log common

<Directory "/var/www/html/domain1">
AllowOverride All 
Options FollowSymLinks 
Require all granted
</Directory>

<Directory "/Document Root/domain1/images">
AllowOverride All 
Options FollowSymLinks 
Require all granted
</Directory>

<Directory "/Document Root/domain1/includes">
AllowOverride All 
Options All
Require all granted
</Directory>

<Directory "/Document Root/domain1/css">
AllowOverride All 
Options All
Require all granted
</Directory>

</VirtualHost>


<VirtualHost *:80>

ServerName www.domain2.com
DocumentRoot "/Document Root/domain2/cuss"
ServerAdmin admin@domain2.com
ErrorDocument 404 /domain2/error/404.php
ErrorLog logs/domain2-error_log
CustomLog "logs/domain2-access_log" common

</VirtualHost>

.htaccess file: file located: Document Root/domain1/ .htaccess文件:位于以下位置的文件:Document Root / domain1 /

DirectoryIndex index.php index.html

Options +FollowSymLinks

RewriteEngine On

RewriteRule ^faq.php http://www.domain1/faq [L]

CheckSpelling on

host file on server: 服务器上的主机文件:

127.0.0.1   localhost.domain    localhost
:1  www.domain1.com localhost6.domain   localhost6
<server ip address> www.domain1.com
<server ip address> www.domain2.com

host file on testing laptop: 测试笔记本电脑上的主机文件:

127.0.0.1       localhost
<server ip address> www.domain1.com
<server ip address> www.domain2.com

I need to get this server into production ASAP! 我需要尽快将该服务器投入生产! Does anyone have any ideas on how to test this to be confident that it will all work correctly when it goes live? 是否有人对如何进行测试有任何想法,以确保它在上线时能够正常运行? Thanks in advance! 提前致谢!

Looks like the same question here: How to use relative/absolute paths in css URLs? 在这里看起来像是相同的问题: 如何在CSS URL中使用相对/绝对路径?

I think you just need to change production link to: 我认为您只需要将生产链接更改为:

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

Because css folder and index file are on the same level. 因为css文件夹和索引文件在同一级别。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM