samba

Apache redirect requests without slash

Nov 3rd, 2011
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. <IfModule mod_rewrite.c>
  2. RewriteEngine On
  3.  
  4. # Gracefully switch between HTTP and HTTPS
  5. RewriteCond %{HTTPS} =on
  6. RewriteRule ^(.+)$ - [env=ps:https]
  7. RewriteCond %{HTTPS} !=on
  8. RewriteRule ^(.+)$ - [env=ps:http]
  9.  
  10. # If requested resource does not exist as a file (or directory)
  11. RewriteCond %{REQUEST_FILENAME} !-f
  12. RewriteCond %{REQUEST_FILENAME} !-d
  13. # and does not end with a slash
  14. RewriteCond %{REQUEST_URI} !/$
  15. # and does not end with a period followed by a filetype
  16. RewriteCond %{REQUEST_URI} !\.[^/]+$
  17. # then add a trailing slash and redirect
  18. RewriteRule (.*) %{ENV:ps}://%{SERVER_NAME}%{REQUEST_URI}/ [R=302,L]
  19. </IfModule>
  20.  
Advertisement
Add Comment
Please, Sign In to add comment