2013-03-28 17:58



I have a contact page on my site set up like this;


<!DOCTYPE html>
<html lang="en">
        <meta charset="utf-8" />
        <link rel="stylesheet" href="webpage.css">
        <?php include 'header.php'; ?>
    </head> of content

I recently set up an htaccess page with some mod_rewrite changes.

So now, I have urls like


When I look at the CSS is not recognized and the page does not print any of my divs but just some worded content.

So if I have

<div id="userinfo">
    User info

It just displays "User info" on the left of the page without the div being recognized.

How can I fix this problem?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • dongleman4760 dongleman4760 8年前

    The href in your CSS is a relative link. So for the browser will request the css file at, but for it will request

    That may cause part of your problem and can be fixed by preceding your hrefs with a /, so href="/webpage.css". The / will cause the browser to always request from the root of your domain so it will always request regardless of the page you're on. If your css is inside some folder within your DocumentRoot (I assume you're using Apache here), you should be providing the full path to the file from the start of the doc root so possibly something like href="/css/webpage.css"

    In the comments, Michael is also correct that you may have a rewrite rule error so please add that information to your question.

    点赞 评论 复制链接分享
  • dousuohe5882 dousuohe5882 8年前

    Use absolute URL beginning from /:

    <link rel="stylesheet" href="/webpage.css" />
    点赞 评论 复制链接分享