[英].htacces RewriteRule redirect
我有一个.htaccess文件,它可以重定向到正确的php文件:
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
/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">
该服务器正在向上映射,因此包含不再起作用。
有什么解决办法吗? 在这种情况下,不能使用http://www.mysite.com/styles/site.css 。
使用像
<link rel="stylesheet" href="/styles/site.css" type="text/css">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.