Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 26th, 2012  |  syntax: None  |  size: 1.35 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. htaccess RewriteRule not letting me acces REAL directories
  2. Options +FollowSymlinks
  3. RewriteEngine On
  4. RewriteBase /
  5.  
  6. # Force add trainling slash
  7. RewriteCond %{REQUEST_URI} !(.[a-zA-Z0-9]{1,5}|/)$
  8. RewriteRule (.*)$ http://foo.bar/$1/ [R=301,L]
  9.  
  10. # Prepent www if not exist in URI
  11. RewriteCond %{HTTP_HOST} ^foo.bar$
  12. RewriteRule (.*) http://www.foo.bar/$1 [R=301,L]
  13.  
  14. # If path is not a directory or file then apply RewriteRule
  15. RewriteCond %{REQUEST_FILENAME} !-f
  16. RewriteCond %{REQUEST_FILENAME} !-d
  17.  
  18. # Rewrite for profile view
  19. RewriteRule ^([^/]+)/?$ profile.php?user=$1 [NC,L]
  20.  
  21. # Rewrite for page view
  22. RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ account.php?type=$1&user=$2&page=$3 [QSA,L]
  23.  
  24. # Condition to ignore regular links
  25. RewriteRule ^library/templates/([^/]+)/([^/]+)/([^/]+)/?$ library/templates/$1/$2/$3 [QSA,L]
  26.  
  27. # Rewrite for dynamic page settings
  28. RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ account.php?type=$1&user=$2&page=$3&$4=$5 [QSA,L]
  29.  
  30. # Rewrite for account view
  31. RewriteRule ^([^/]+)/([^/]+)/?$ account.php?type=$1&user=$2 [QSA,L]
  32.  
  33. # Rewrite for site default resources location
  34. RewriteRule ^([^/]+)/([^/]+)/theme/s/([^/]+)/([^/]+)/([^/]+)/?$ library/themes/site/$3/$4/$5 [QSA,L]
  35.        
  36. www.foo.bar/path/to/real/dir
  37.        
  38. RewriteCond %{REQUEST_FILENAME} -f [NC,OR]
  39. RewriteCond %{REQUEST_FILENAME} -d [NC,OR]
  40. RewriteCond %{REQUEST_FILENAME} -l [NC]
  41. RewriteRule .* - [L]