hide folder or path css js files with httacces

1.2k Views Asked by At

i'm trying this:

.htaccess

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

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

</IfModule>
# END 

html file

<!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>

but nothing happens. h1 don't change it's color.

PD: inside folder wp-content exists customjd.css h1 color red.

1

There are 1 best solutions below

0
hjpotter92 On BEST ANSWER

Edit the htaccess code to:

RewriteEngine On

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

Change the HTML code to:

<!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>

where the CSS code inside customjd.css is:

h1 {
  color: red;
}