views:

38

answers:

2

The htaccess file requires an entry at the end of /folder/ to redirect the page

example:
http://www.server.com/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]
+1  A: 

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]
Jan Kuča
This would also work, but its syntax is kind of weird and it requires Apache to hit the file stat cache on every request.
Dan Beam
+3  A: 
# 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
Dan Beam