View HTTP header (esempio)
HTTP/1.1 200 OK
Date: Fri, 27 Apr 2018 07:59:06 GMT
Content-Type: text/html; charset=UTF-8
Connection: close
Set-Cookie: __cfduid=d047683e2225426554c96d71a9e7d21521524815946; expires=Sat, 27-Apr-19 07:59:06 GMT; path=/; domain=.evemilano.com; HttpOnly
Vary: Accept-Encoding
Link: <https://www.evemilano.com/wp-json/>; rel="https://api.w.org/"
X-Cache: HIT
Strict-Transport-Security: max-age=15552000; preload
X-Content-Type-Options: nosniff
View Personalizzare il Prompt Banner delle notifiche push
<script>
var OneSignal = window.OneSignal || [];
OneSignal.push(["init", {
appId: "12341234-1234-1234-1234-12341234",
safari_web_id: "web.onesignal.auto.12341234-1234-1234-1234-12341234",
autoRegister: false,
notifyButton: {
enable: false,
showCredit: false
},
View Come usare due Service Worker
<!-- PWA & Push Service Worker -->
<script>
// If service workers are supported, and one isn't already registered
if ('serviceWorker' in navigator && !navigator.serviceWorker.controller) {
navigator.serviceWorker.register('/OneSignalSDKWorker.js');
console.log("OneSignalSDKWorker.js loaded...");
}
</script>
View OneSignalSDKUpdaterWorker.js
importScripts('https://www.evemilano.com/sw.js');
importScripts('https://cdn.onesignal.com/sdks/OneSignalSDK.js');
View Nginx Speed Configuration
server {
listen 80 default_server;
listen [::]:80 default_server;
gzip on;
gzip_comp_level 5;
gzip_min_length 256;
gzip_proxied any;
gzip_vary on;
View Examples
## From permalink "Day and Name (/%year%/%monthnum%/%day%/%postname%/)" to "postname"
RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)$ http://www.yourwebsite.com/$4
## From permalink "Month and Name (/%year%/%monthnum%/%postname%/)" to "postname"
RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/(.*)$ http://www.yourwebsite.com/$3
## From permalink "Numeric (/archives/%post_id%)" to "postname"
RedirectMatch 301 ^/archives/(\d+)$ http://www.yourwebsite.com/?p=$1
View WordPress Plugin Dynamic Prerender Meta Tag
<?php
/*
Plugin Name: EVE Dynamic Prerender Meta Tag
Plugin URI: https://www.evemilano.com/2017/11/wp-prerender-plugin/
Version: 3.5.3
Description: This WordPress plugin creates and inject into HTML head a Dynamic Prerender Meta Tag. The system stores users navigational paths inside the database e retrieve the most common next visited page as prerender meta tag. If the plugin doesn't has data for the next probable page, it will show a prerender to the homepage. The database table WILL BE REMOVED automatically when the plugin is uninstalled but not when disabled. Do not remove the plugin if you want to keep data. The database table can grow up a lot in large websites, keep an eye on it!
Author: Giovanni Sacheli
Author URI: https://www.evemilano.com/
*/
View Da usare nel file functions.php
//* ---------------------- DISABLE REST API ---------------------- *//
add_action( 'after_setup_theme', 'remove_json_api' );
function remove_json_api () {
// Remove the REST API lines from the HTML Header
remove_action( 'wp_head', 'rest_output_link_wp_head', 10 );
remove_action( 'wp_head', 'wp_oembed_add_discovery_links', 10 );
// Remove the REST API endpoint.
View Service Worker Registration
<script>
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/sw.js')
.then(function(registration) {
console.log('Registration successful, scope is:', registration.scope);
})
.catch(function(error) {
console.log('Service worker registration failed, error:', error);
});
}
View Link Rel Manifest