1

htaccess 文件的末尾需要一个条目/folder/来重定向页面

示例:
http://www.server.com/folder/"some-page-name"

如果没有定义页面,那么我希望它默认为“索引”

过程

RewriteBase /folder/
RewriteRule ^(.*)$ subfolder/index.php/?page=$1 [L]
4

2 回答 2

3
# there must be something after /folder/ for this to work
RewriteBase ^/folder/(.+)$  /folder/subfolder/index.php/?page=$1 [L]

# if there isn't, do a catch-all redirect (change to whatever "index by default" means)
RewriteRule ^/folder/$      /folder/index
于 2010-09-26T10:33:18.193 回答
1

如果要检查文件是否存在并将用户重定向到索引(如果不存在),请使用以下条件:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond .* index [R=301]
于 2010-09-26T10:28:44.617 回答