2015-11-15 65 views
0

我想要这样的:隐藏文件夹或路径CSS与JS文件httacces

的.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颜色为红色。

+0

位置? – hjpotter92

+0

@ hjpotter92 http:// localhost/proyect/rewrite/ – metalbox

回答

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> 

其中内customjd.css的CSS代码:htaccess的的

h1 { 
    color: red; 
} 
+0

真棒!谢谢! – metalbox