使用.htaccess时,Css文件丢失了

时间:2016-12-11 09:05:33

标签: php css .htaccess

RewriteEngine On

# redirect "/post.php?id=xxx" to "/post/xxx"
RewriteCond %{THE_REQUEST} \s/post\.php\?id=([0-9]+)\s [NC]
RewriteRule ^ /post/%1? [R=301,L]

# internally rewrite "/section/xxx" to "/post.php?id=xxx"
RewriteRule ^post/([0-9]+)$ /post.php?id=$1 [L]

1 个答案:

答案 0 :(得分:0)

因为您更改了根(使用/post/添加一个级别) 在post.php HTML <head>

中添加此行
<base href="/">

或者在css文件名前添加/

<link rel="stylesheet" ... href="/css/name.css">