simple redirect to default page with htaccess
The htaccess file requires an entry at the end of /folder/
to redirect the page
http://www.server.com/开发者_JAVA技巧folder/"some-page-name"
If no page is defined as, then I want it to be "index" by default
the htacess
RewriteBase /folder/
RewriteRule ^(.*)$ subfolder/index.php/?page=$1 [L]
# 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
If you want to check whether the file exists or not and redirect the users to the index (if is does not), use the following condition:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond .* index [R=301]
精彩评论