2015-11-15 66 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