2013-10-21 266 views
0

我有一个重定向到正确的PHP文件.htaccess文件:.htacces重写规则重定向

Options -Indexes 

RewriteEngine on 
RewriteOptions MaxRedirects=1 
RewriteCond %{REQUEST_FILENAME} -f [NC,OR] 
RewriteCond %{REQUEST_FILENAME} -d [NC] 
RewriteRule .* - [L] 
RewriteRule ^(.*)$ read.php/$1 [QSA,L] 

例如mysite.com/post/100重定向到mysite.com/post/read.php,我可以在我的PHP文件中使用100作为标识。

这一切都很好,直到我使用mysite.com/post/100/mysite.com/post/100/abc。该文件仍然被重定向,但我的所有css文件和include()都不起作用。

<link rel="stylesheet" href="../styles/site.css" type="text/css"> 

这台服务器要往上一张地图,所以include不再工作了。

任何解决方案?在这种情况下,使用http://www.mysite.com/styles/site.css不是解决方案。

回答

1

使用像

<link rel="stylesheet" href="/styles/site.css" type="text/css"> 
绝对路径