Jump to content

Editing the original PW .htaccess file best practice?


Recommended Posts

Posted

I want to add disabling of hot-linking for webfonts to the .htaccess file but I kinda don't want to 'mess' with the one that comes with PW.

What would you suggest? Does anyone else do specific .htaccess additions without adjusting the original PW version? Or am I just being silly?

RewriteEngine On
# RewriteCond %{HTTP_REFERER} !^http(.?)://(.+\.)?yourdomain\.com/ [NC]
# RewriteRule .*\.(woff|ttf|eot|svg|php)$ - [F]

AddType application/vnd.ms-fontobject .eot
AddType application/x-font-woff .woff
AddType font/ttf .ttf
AddType image/svg+xml .svg
AddType text/css .css

<FilesMatch "\.(woff|ttf|svg|eot|css)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>

 

Posted

Well, as long as it works, it works. Of course, you should always keep a backup in case you break something. The only stuff I usually add is blocking bad bots and some performance tweaks (compression, cache rules).

Posted
19 minutes ago, dragan said:

Well, as long as it works, it works. Of course, you should always keep a backup in case you break something. The only stuff I usually add is blocking bad bots and some performance tweaks (compression, cache rules)./

Would you just add at the bottom, or create a new section '5B' or something so it keeps everything tidy or avoid this so you know what is yours/PWs standard?

Posted

I always keep separate blocks at the bottom. In any case, I add lots of comments, so I know what each block is supposed to do, if I have to touch it years later ?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...