Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource

If you have following error

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at

Then you need to add some lines to your .htaccess file

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

Header add Access-Control-Allow-Origin „*“
Header add Access-Control-Allow-Headers „origin, x-requested-with, content-type“
Header add Access-Control-Allow-Methods „PUT, GET, POST, DELETE, OPTIONS“

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

С етикет: , , , ,
Публикувано в Joomla, linux, wordpress

windows 10 disable fastboot

Sometimes you need to disable FastBoot on laptop on which you don’t have such option in the BIOS

To do it you can modify following registry key

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Power

HiberbootEnabled DWORD

0 = Turn off fast startup
1 = Turn on fast startup

С етикет: , , , , , ,
Публикувано в Без категория

wordpress forse css styles version

Sometime css files version need to be set so update to be forced on all users which are visiting the site

This can be done very easy in wordpress just need to add those lines in function.php of the theme

function my_wp_default_styles($styles)
{
	//use release date for version
	$styles->default_version = "20160714";
}
add_action("wp_default_styles", "my_wp_default_styles");
С етикет: , , , ,
Публикувано в wordpress

Redirect all php files to wordpress posts or strip .php extension

If you need to redirect your old urls which are like

alabala.com/see-this-post.php to alabala.com/see-this-post/

You can use this simple .htaccess redirect

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)\.php$ /$1/ [l,R=301,NC]

С етикет: , , ,
Публикувано в wordpress

wordpress strange redirect

WordPress is using lowercase in all urls but when someone types the url in the address bar then browser uses uppercase to encode url

Uppercase is different from lowercase and wordpress can’t match url

So solution is very simply

This fragment need to be pasted in functions.php

function unFocus_insensitivity() {
    if (preg_match('/[A-ZА-Я]/', $_SERVER['REQUEST_URI'])) {
        $_SERVER['REQUEST_URI'] = strtolower($_SERVER['REQUEST_URI']);
        $_SERVER['PATH_INFO']   = strtolower($_SERVER['PATH_INFO']);
    }
}
add_action('init', 'unFocus_insensitivity');

Code is working for Latin and Cyrillic letters

С етикет: , , , ,
Публикувано в wordpress