Forum Moderators: phranque
I want to have www.site.com/folderx/ to redirect to a processing page like, www.site.com/process.php?ID=folderx.
Basically, process.php needs to know the folderx name.
I only want it to redirect if that folder doesn't exist already. So if /user/ was a real folder on the system, it will process the script /user/index.php and NOT redirect to the process.php script at all :)
Hope you all can help!
Thanks!
#
# turn on mod_rewrite
RewriteEngine on
#
# verify that DOCROOT/REQUESTED_PATH is not a directory
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}!-d
#
# Rewrite; capture the non-slash characters after
# the initial '/' in $1 and use that as the 'ID' to
# pass to process.php
RewriteRule ^/([^/]+)/?$ /process.php?ID=$1 [L]
1) leading '/' characters should be removed from RewriteRule lines when placing the rules in .htaccess files; thus:
RewriteRule ^/foo/bar /path/to/file [L]
RewriteRule ^foo/bar /path/to/file [L]
2) mod_rewrite needs to be both enabled on the server (the module needs to be loaded) and the FileInfo option to AllowOverride needs to be active for the directory containing your .htaccess file; If *either* of these not true, mod_rewrite will not work in .htaccess files.