【问题标题】:hide folder or path css js files with httacces使用 htaccess 隐藏文件夹或路径 css js 文件
【发布时间】:2015-11-15 13:20:16
【问题描述】:

我正在尝试这个:

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

【问题讨论】:

标签: html css mod-rewrite base-tag


【解决方案1】:

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 代码在哪里:

h1 {
  color: red;
}

【讨论】:

    猜你喜欢
    • 2018-04-05
    • 2016-07-20
    • 2010-11-25
    • 1970-01-01
    • 2020-07-05
    • 1970-01-01
    • 1970-01-01
    • 2014-07-23
    • 2019-02-23
    相关资源
    最近更新 更多