You may try this:
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
# Prevent loops
RewriteCond %{REQUEST_URI} !index\.php [NC]
RewriteCond %{REQUEST_URI} ^/([^/]+)/([^/]+)/? [NC]
RewriteRule .* %1/index.php?page=%2 [L]
Maps silently:
http://www.somedomain.com/anyfolder/val
with or without trailing slash.
The above is the URL entered and shown in the browser's address bar.
To:
http://www.somedomain.com/anyfolder/index.php?p=val
Strings anyfolder
and val
are assumed to be dynamic.
For permanent redirection, replace [L]
with [R=301,L]
.