×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Text
Posted by: Joseph Orlando
Added: Mar 13, 2013 10:58 PM
Modified: Mar 13, 2013 11:00 PM
Views: 37
Allow for alias redirection:
"http://www.example.com/USERNAME" => "http://www.example.com/index.php?user=USERNAME"

Strong htaccess protection
Protect against clients accessing htaccess

Example Details:
This example redirects all requests to: "http://domain/example" to "http://domain/index.php?user=example" ONLY IF "example" isnt an existing file or directory, specifically directory: "videos"
  1. # User Alias Redirection
  2. RewriteCond %{REQUEST_FILENAME} !-f
  3. RewriteCond %{REQUEST_FILENAME} !-d
  4. RewriteCond %{REQUEST_URI} !^/videos/
  5. RewriteRule ^(.*)  /index.php?user=$1  [QSA,L]
  6.  
  7. # STRONG HTACCESS PROTECTION
  8.  <Files ~ "^.*\.([Hh][Tt][Aa])">
  9.   order allow,deny
  10.   deny from all
  11.   satisfy all
  12.  </Files>