RewriteEngine On # Options All | Indexes Includes +MultiViews FollowSymlinks Options All # RewriteBase / # Check for Direct Link Activity RewriteRule . - [E=DIRECTLINK:false] RewriteCond %{HTTP_REFERER} ^$ RewriteRule . - [E=DIRECTLINK:true] # Check for HotLink Activity RewriteRule . - [E=HOTLINK:false] RewriteCond %{ENV:DIRECTLINK} !^true$ RewriteCond %{HTTP_REFERER} !^http://(www\.)?runeimp.dev/.*$ [NC] # Dev Local RewriteCond %{HTTP_REFERER} !^http://(www\.)?runeimp.com/.*$ [NC] # Live RewriteRule . - [E=HOTLINK:true] # Check for HotLinked Image RewriteCond %{ENV:HOTLINK} ^true$ RewriteCond %{REQUEST_URI} ^(/assets/img/.+)$ RewriteRule . - [E=HOTLINK_IMG:true,E=HOTLINK_IMG_PATH:%1] # Update expected Var with Redirected Original RewriteCond %{ENV:REDIRECT_HOTLINK_IMG} ^true$ RewriteCond %{ENV:REDIRECT_HOTLINK_IMG_PATH} ^(.+)$ RewriteRule . - [E=HOTLINK_IMG:true,E=HOTLINK_IMG_PATH:%1] # Update expected Var with Double-Redirected Original RewriteCond %{ENV:REDIRECT_REDIRECT_HOTLINK_IMG} ^true$ RewriteCond %{ENV:REDIRECT_REDIRECT_HOTLINK_IMG_PATH} ^(.+)$ RewriteRule . - [E=HOTLINK_IMG:true,E=HOTLINK_IMG_PATH:%1] # If Hotlinking an image Redirect to NO OPeration image. RewriteCond %{ENV:HOTLINK_IMG} ^true$ RewriteRule . / [R,L] RewriteRule .*\.(gif|jpe?g|png)$ /assets/img/noop.jpg [R,NC,L] # Rewrite assets paths to _assets path RewriteRule ^assets/(.+) _assets/$1 [L,QSA] # # Handle Static HTML files # RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.+)$ $1.php [L,QSA] RewriteCond %{REQUEST_FILENAME}.html -f RewriteRule ^(.+)$ $1.html [L,QSA] ## # If matching root directorie does not starts with an underscore and is not # THE root directorie, do nothing (no substitution) and set ENV PASSTHRU_DIR with the value 1. # Very secure. # RewriteCond %{REQUEST_URI} ^/(assets|eq|javatest|php|portfolio|projects|prose|tools)/.* RewriteCond %{REQUEST_URI} !=/ RewriteRule ^ - [E=PASSTHRU_DIR:1,PT,L] # # Pass everything else to index.php # RewriteCond %{REQUEST_FILENAME} !-f # RewriteCond %{REQUEST_FILENAME} !-d # RewriteRule . phptool.php [L] # For Testing RewriteRule . index.php [L]