I am trying to do the following...
If a page called login.asp
exists then allow a rewrite for it as /login/ but do not allow a direct access to login.asp
.
Here is my code so far.
# Helicon ISAPI_Rewrite configuration file
# Version 3.1.0.87
RewriteEngine On
# if file is not exists
RewriteCond %{DOCUMENT_ROOT}/$1 !-f
# if folder is not exists
RewriteCond %{DOCUMENT_ROOT}/$1 !-d
# From start to end, "^(\w+)[/]+$" only matches with one or more alphanumeric characters and "_".
# Alternatively can end with one or more slashes.
# Change [R = 302, L] to [L] if you want make a rewrite instead of redirect.
RewriteRule ^(\w+)[/]*$ /username.asp?username=$1 [L]
So if you imagine the user types www.web.com/contact
if there is a page called contact.asp
it displays that rewritten content. If the .asp page does not exist then it loads the content from /user.asp?username=contact
to check if it is a user profile.
Much appreciated!
C