Posts

Free WordPress Classic Widget (Plugin) Google Maps

Image
WS GMaps is a classic Google Maps widget (plugin) for the WordPress CMS. The widget allows you to set multiple points on the map. Furthermore, multiple widgets can be used on a single page. The plugin is free to download. To use the plugin, you must provide a JavaScript Maps API key for Google Maps. You can generate an API key in the Google Cloud Platform (https://console.cloud.google.com/). In the admin panel, the plugin settings look like this: If you are using the classic widget, the plugin settings in the admin panel will look like this: You can set a description for a point on the map that will appear when clicked. This marker description can use HTML. You can see how this works in the example. If there are multiple markers on the map, you can specify the map center in the designated fields. If the map center is not specified, the first marker will be used as the center. You can download the plugin for free and view the demo here – Get WS GMaps .

Adding a website to free directories

Submitting your website to online directories remains a valuable SEO technique, even in today’s world of constantly evolving search engine algorithms. While some marketers consider it an old-fashioned approach, directory submissions can still improve a website’s visibility and credibility when used strategically. Search engines treat high-quality directory listings as reliable backlinks, which help build your site’s authority and improve its ranking in search results. Directories act as a bridge between users and businesses, making it easier for potential customers to find your site within specific niches or regions. When your website is listed in relevant directories, it has a higher chance of attracting targeted traffic — people who are already interested in the products or services you offer. Additionally, listings in respected directories can generate referral traffic that comes directly from those platforms, not just from search engines. It’s important, however, to choose dir...

Closing a site with .htaccess

Image
The .htaccess file performs many different functions. This is an apache configuration file. Consider how to set a password for access to the site using .htaccess . This may be needed at design time or as an additional security tool. Video instruction To store the password (or passwords) from the directory, you need to create another file. Usually it is called .htpasswd , but you can call it differently. Put this file must be in the root of the site or above Sample entry in .htaccess AuthName "Authentication required" AuthType Basic AuthUserFile /home/yourdir/.htpasswd Require user yourlogin Set the password for yourlogin user in the .htpasswd file yourlogin:Mk5aMaDxjJch2 The link to generate passwords https://stringutils.online/htpasswd

Remove www in the site address, 301 redirects

A redirect is to redirect site visitors from one URL to another. 301 status indicates that the redirect is permanent. Removing www from the site address is necessary primarily for SEO . Since sites with www and without for search engines are different sites with the same content. For Apache server, you need to make an entry in the .htaccess file RewriteCond %{HTTP_HOST} ^www.example.com RewriteRule ^(.*)$ http://example.com/$1 [R=301,L] For NGINX , write in the site configuration file if ($host ~* www\.(.*)) { set $host_without_www $1; rewrite ^(.*)$ http://$host_without_www$1 permanent; } $host_without_www - write like that, this is a server variable

Ways to Create Objects in JavaScript

There are several ways to create objects in JavaScript . The Object data type plays a critical role in JS . An object is an unordered set of key-value pairs. May contain other objects 1. Literal notation var someObject_1 = {}; Perhaps the most common and easiest way. Let's add properties and methods someObject_1.name = "John"; someObject_1.age = 25; someObject_1.run = function(){ console.log("run") } And now the same thing, but we will set properties and methods when creating var someObject_1 = { name: "John", age: 25, run: function(){ console.log("run"); } }; 2. Object constructor This method is not recommended for use, and it is better to use the previous one. Nevertheless, it exists. But the probability of meeting him is extremely small var someObject_2 = new Object(); We also set properties and methods var someObject_2 = { name: "Nick", age: 30, jump: function(){ conso...

Configure https for Nginx

HTTPS is an advanced data transfer protocol that supports encryption. Install free ssl certificate from Lets Encrypt . Ubuntu server operating system Get a certificate sudo letsencrypt certonly -a webroot --webroot-path=/var/www/site.com/public_html -d site.com -d www.site.com Prolong sudo letsencrypt renew nginx config server { listen 80 ; server_name site.com.ru www.site.com; return 301 https://$server_name$request_uri; } server { # SSL configuration listen 443 ssl http2; listen [::]:443 ssl http2; server_name site.com www.site.com; ssl_certificate /etc/letsencrypt/live/site.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/site.com/privkey.pem; ssl_trusted_certificate /etc/letsencrypt/live/site.com/chain.pem; add_header Content-Security-Policy "img-src https: data:; upgrade-insecure-requests"; # We keep access log: access_log /var/log/nginx/site.com_access.log; # We share static and dynamic, static ...

PHP Data Caching

Sometimes it becomes necessary to limit the number of queries to an external data source. Especially if they do not change constantly. For example, the exchange rate in the central bank. Or simply speed up the page loading, giving the script an already generated file. $expires = 3600; //Cache lifetime in seconds $curTime = time(); $cacheFile = 'data.json'; function writeCache($cacheFile) { //get fresh data file_put_contents($cacheFile, file_get_contents('http://somesite.com/api')); } if (!file_exists($cacheFile)) { writeCache($cacheFile); } else { $fMtime = filemtime($cacheFile); if (($curTime - $fMtime) > $expires) { writeCache($cacheFile); } } This caching method is based on comparing the date of the file change with the cache with the current time.