# ----------------------------------------------------------------------
# Htaccess Authentication
# Gunakan password generator .htpasswd
#
http://aspirine.org/htpasswd_en.html
# ----------------------------------------------------------------------
AuthType Basic
AuthName "Auth by PAIJO-PAIJEM"
AuthUserFile /path/to/.htpasswd
Require user
exampleusername
# In the .htpasswd just write the output from the Password Generator:
exampleusername:$apr1$8cah0v1u$TDjVh0
# ----------------------------------------------------------------------
# Http to Https
# ----------------------------------------------------------------------
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
# ----------------------------------------------------------------------
# www to non-www URLs 301 Redirect
# ----------------------------------------------------------------------
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.paijo-paijem.com$
RewriteRule (.*)
https://paijo-paijem.com/$1 [R=301,L]
</IfModule>
# ----------------------------------------------------------------------
# Slash to Non-Slash URLs 301 Redirect
# ----------------------------------------------------------------------
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
</IfModule>
# ----------------------------------------------------------------------
# Pages With to Without Extension (php|html|htm) 301 Redirect
# ----------------------------------------------------------------------
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^/?(.*).(php|html|htm)$ /$1 [R=301,L]
</IfModule>
# ----------------------------------------------------------------------
# Page to Parent Directory 301 Redirect
# ----------------------------------------------------------------------
<IfModule mod_rewrite.c>
RewriteEngine on
Redirect 301 /1/2/3/blog.php /1/2/3
</IfModule>