I like to redirect requests from /user_name/somefile to /somefile
i.e. /user_name/site.php?query should call /site.php?query
If just /user_name/ or /user_name is requested, it should redirect to /portal.php?lusername=user_name
Because not all subdirs are virtual I've excluded the real one
On one server the following works fine, but on another sever the redirect of /user_name/somefile to /somefile
didn't work (Error 404)
- Code: Select all
RewriteEngine on
# exclude those dirs
RewriteRule ^/(cgi-bin|phpimage|topangebote|images|cadmin|ibe|cache|phpThumb|tf_intranet)/(.*)$ - [L]
# if file not exist
RewriteCond %{REQUEST_FILENAME} !-f
# two levels
RewriteRule ^/(.*)/(.*)/(.*)\.(.*)$ /$3.$4 [L]
# one level
RewriteRule ^/(.*)/(.*)\.(.*)$ /$2.$3 [L]
# do nothing on these extensions
RewriteRule ^/(.*)\.(php|gif|jpe?g|pdf|txt|html?|html|htm|js|png|ico|cfg|pl)$ - [L]
# entry redirect
RewriteRule ^/(.*)/$ /portal.php?lusername=$1 [L]
RewriteRule ^/(.*)$ /portal.php?lusername=$1 [L]
Has anyone a clue what's wrong?