htaccess文件需要/folder/
末尾的条目才能重定向页面
例如:
http://www.server.com/folder/"some-page-name"
如果没有定义页面,那么我希望它默认为“索引”
htacess
RewriteBase /folder/
RewriteRule ^(.*)$ subfolder/index.php/?page=$1 [L]
答案 0 :(得分: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
答案 1 :(得分:1)
如果要检查文件是否存在并将用户重定向到索引(如果不存在),请使用以下条件:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond .* index [R=301]