htaccess拒绝我的页面以获取样式


htaccess denies my page to get style

我使用.htaccess是为了清理我的链接。链接看起来像:

http://www.mydomain.com/home/param2/param3

我使用一个爆炸函数来获取我的参数:

$url = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$aPages = explode("/", $url);
if($num >= 0){
    return $aPages[$num];
}
else{
    return $url;
}

我的htaccess文件

RewriteEngine On
RewriteCond %{REQUEST_URI} !=/index.php
RewriteRule .* /index.php

如果我的第一个参数("home")为空,它将重定向到一个页面,说"找不到页面"。这一切都很好,但当我调用样式表('/css/style.css')时,网站会做同样的事情,不会加载我的样式表。我该如何解决这个问题?

试试这个?

Options +FollowSymLinks
IndexIgnore */*
# Turn on the RewriteEngine
RewriteEngine On
#  Rules
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php

尝试

RewriteEngine on
RewriteCond $1 !^(index'.php|images|robots'.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]