有没有办法在我的.htaccess中执行此操作?我尝试了一些解决方案,但无法使其正常工作......
Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/user/$1\ -f [NC]
RewriteRule ^(.+?)/?$ /folder/\?$1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1\ -f [NC]
RewriteRule ^(.+?)/?$ /\?$1 [L]

答案 0 :(得分:0)
-f
标记之前的空格不应转义。
将规则更改为:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/user/$1 -f [NC]
RewriteRule ^(.+?)/?$ /folder/?$1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1 -f [NC]
RewriteRule ^(.+?)/?$ /?$1 [L]