【发布时间】:2015-06-02 22:26:24
【问题描述】:
我知道这是一个非常简单的问题,但我现在真的很困惑。我尝试了几个选项,但结果都是一样的:CSS file is not found if I use mod_rewrite
解决方案应包含的内容:
- domain.tld -> www.domain.tld
- www.domain.tld/category/page-title -> index.php?a=category&b=page-title
- www.domain.tld/category/page-title/ -> index.php?a=category&b=page-title
- www.domain.tld/category -> index.php?a=category
- www.domain.tld/category/ -> index.php?a=category
.htaccess:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.tld
RewriteRule (.*) http://www.domain.tld/$1 [R=301,L]
RewriteEngine on
RewriteCond %{REQUEST_fileNAME} !-d
RewriteCond %{REQUEST_fileNAME} !-f
RewriteRule ^(.*)/(.*)/?$ index.php?a=$1&b=$2
RewriteRule ^(.*)/?$ index.php?a=$1 [L]
index.php:
<link href="/css/bootstrap.min.css" rel="stylesheet">
<link href="/css/internal.css" rel="stylesheet">
【问题讨论】:
-
其他一切是否也如您所愿?具体点 1 到 5?
标签: php regex apache .htaccess mod-rewrite