0

我正在尝试这个:

.htaccess

# BEGIN 
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /proyect/rewrite/

RewriteRule ^css/(.*) /proyect/rewrite/wp-content/$1 

</IfModule>
# END 

.html 文件

<!DOCTYPE html>
<html>
<head>

<!-- H1 COLOR BLUE -->
<link href="http://localhost/proyect/rewrite/wp-content/css/customjd.css" rel="stylesheet" type="text/css" > 

<!-- H1 COLOR RED-->
<base  href="/customjd.css" >

</head>

<body>

<h1>hello world!</h1>

</body>

</html>

但什么也没发生。h1 不要改变它的颜色。

PD:文件夹 wp-content 内存在 customjd.css h1 颜色红色。

4

1 回答 1

2

htaccess将代码编辑为:

RewriteEngine On

RewriteRule ^(css/.*\.css)$ /proyect/rewrite/wp-content/$1

将 HTML 代码更改为:

<!DOCTYPE html>
<html>
<head>
  <base href="/proyect/rewrite/">
  <link href="css/customjd.css" rel="stylesheet" type="text/css">
</head>
<body>
  <h1>hello world!</h1>
</body>
</html>

里面的CSS代码customjd.css是:

h1 {
  color: red;
}
于 2015-11-15T05:19:45.713 回答