我创建了以下适用的规则:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)$ /search?type=$1&query=$2 [L]
RewriteRule ^([^/]*)/([^/]*)/([^/]*)$ /search?type=$1&query=$2&condition=$3 [L]
这会进行以下转换
/title/limitless = /search?type=title&query=limitless
但现在问题是我无法访问根文档中其他文件夹的资源,例如/images
或/css
我做错了什么?
答案 0 :(得分:1)
让你的规则忽略文件/目录的重写:
Options +FollowSymLinks -MultiViews
RewriteEngine On
# skip all rules for real files and directories
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
RewriteRule ^([^/]+)/([^/]+)/?$ /search?type=$1&query=$2 [L,QSA]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ /search?type=$1&query=$2&condition=$3 [L,QSA]