Hostgator 网站未加载 css 文件
Host Gator site not loading css file
我最近刚在 host gator 注册了一个域名。我使用 FTP (Filezilla) 将我的 index.html 文件和 style.css 文件上传到主机 gator 的 public_domain 目录中。当我转到 URL Dylan's Portfolio 时,我可以在 index.html 文件中看到网站内容,但是 css 规则的 none 适用。我使用控制台检查了该页面,并收到 404 错误,提示找不到 css 文件。我已经使用相对路径和绝对路径将 css 文件链接到我的 index.html 文件中,但我仍然无法弄清楚。请帮助:(
你的目录结构问题。
将 style.css
放入 root_directory
中的 css
文件夹中
root_directory
|-css
|-style.css
或
编辑您的 html
<link rel="stylesheet" href="style.css">
这很奇怪,我认为这是因为我在 hostgator 上支付的版本,但我也遇到了这个问题:
www.mysite.com 没有让我打开任何 .js .minjs .css .png .jpg 等,无论是文件夹还是与协议(http 或 https)相关的其他问题
我必须像这样在每个文件夹 css、img、js 等上使用 .htaccess 文件来解决它。
RewriteEngine on
RewriteCond %{REQUEST_URI} ^\.(gif|jpe?g|png)$ [NC]
RewriteRule .? - [F,L]
也许它不是最好的但有效
我最近刚在 host gator 注册了一个域名。我使用 FTP (Filezilla) 将我的 index.html 文件和 style.css 文件上传到主机 gator 的 public_domain 目录中。当我转到 URL Dylan's Portfolio 时,我可以在 index.html 文件中看到网站内容,但是 css 规则的 none 适用。我使用控制台检查了该页面,并收到 404 错误,提示找不到 css 文件。我已经使用相对路径和绝对路径将 css 文件链接到我的 index.html 文件中,但我仍然无法弄清楚。请帮助:(
你的目录结构问题。
将 style.css
放入 root_directory
css
文件夹中
root_directory
|-css
|-style.css
或
编辑您的 html
<link rel="stylesheet" href="style.css">
这很奇怪,我认为这是因为我在 hostgator 上支付的版本,但我也遇到了这个问题:
www.mysite.com 没有让我打开任何 .js .minjs .css .png .jpg 等,无论是文件夹还是与协议(http 或 https)相关的其他问题
我必须像这样在每个文件夹 css、img、js 等上使用 .htaccess 文件来解决它。
RewriteEngine on
RewriteCond %{REQUEST_URI} ^\.(gif|jpe?g|png)$ [NC]
RewriteRule .? - [F,L]
也许它不是最好的但有效