Category Archives: .htaccess

Add trailing slash on url

This is for .htaccess of WordPress, but it can be adjusted

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

# Add trailing slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)([^/])$ /$1$2/ [L,R=301]

RewriteRule ^index.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

Remove password restriction for certain ips

SetEnvIf Remote_Addr “^81.181.19.216$” IsIntern
SetEnvIf Remote_Addr “^82.145” IsIntern

AuthType Basic
AuthName “OKU Forum”
AuthUserFile /var/www/vhosts/tv0.no/httpdocs/.htpasswd
Require valid-user
Order allow,deny
Allow from env=IsIntern
satisfy any