我正在使用mod_rewrite来更改站点上的所有URL.示例:http://www.site.com/about/成为http://www.site.com/?action=about(不用担心,我有很好的友好理智检查).问题是除了http://www.site.com/CSS样式表之外的任何其他内容都不会加载.我认为这是因为它寻找样式表/about/content/style.css而不是/content/style.css.如何确保找到合适的样式表?
以下是我的一些代码以防万一..htaccess看起来像这样:
RewriteEngine on
RewriteRule ^news/([0-9]+)/?$ /?action=news&start=$1 [L]
RewriteRule ^news/?$ /?action=news&start=0 [L]
RewriteRule ^(about|contact|man|home|download)/?$ /?action=$1 [L]
Run Code Online (Sandbox Code Playgroud)
他们都重定向到index.php,开始时这样:
<html>
<head>
...
<link rel="stylesheet" href="content/style.css" type="text/css" />
</head>
<body>
...
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
试试这个.
<link rel="stylesheet" href="/content/style.css" type="text/css" />
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
904 次 |
| 最近记录: |