我对url重写有点困惑…
我已将contact.php页面改写为contact.html…
RewriteRule ^contact.html/?$ contact.php [NC,L]
效果很好但是当我输入WordPress
RewriteRule ^contact/contact.html/?$ contact.php [NC,L]
它工作,但CSS和图像没有在这个页面上调用。
我试过了
RewriteCond %{REQUEST_FILENAME} !-f
但它不起作用。
我想知道在。htaccess文件中是否有任何条件来处理这个wordpress页面。
有几个代码为我工作。因为你没有在问题中给出实际的错误。试一试……
你可以在页面的<head>
部分尝试这样做,以支持该页上引用的图像/css/js文件的相对路径:
<head>
<base href="http://www.example.com/static-files/" />
</head>
参考http://www.w3.org/TR/html4/struct/links.html#h-12.4
2}链接相对于根目录的CSS文件示例:
<link rel="stylesheet" type="text/css" href="/css/****.css">
在你的.htaccess
中试试这个RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^.*.(css|jpe?g|gif|png|js|ico)$ [NC]
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]