htaccess

SSL Required and Redirect

RewriteEngine On
RewriteCond %{SERVER_PORT} !443
RewriteRule (.*) https://example.com/path/ [R]
  • Or may just combine SSLRequireSSL with a Redirect
SSLRequireSSL
#no non-ssl access
Redirect permanent /secure https://www.example.com/secure

Auth Required

AuthUserFile /home/joe/.htpassdb
AuthName "Restricted - Joe's Files"
AuthType Basic
<Limit GET>
require user joe
</Limit>
# or "require valid-user"
  • Note: be sure to include the full path to the AuthUserFile as by default it will look in the /etc/apache directory.

Simple Redirect

Redirect /tnt http://acm.unomaha.edu/~bw/tnt/
Redirect /1400 http://acm.unomaha.edu/~bw/1400
Redirect /email https://freemail.cotse.net/freemail/mail/src/login.php
Redirect /notes https://brianwiese.net/files/notes

Error Redirect

ErrorDocument 404 /notfound.html
ErrorDocument 403 http://somesite.com/errors/403.php
 
howto/htaccess.txt · Last modified: 2006/06/11 15:55 by 24.6.69.68
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki