Friday , December 20 2024

Useful solutions

Useful solutions – articles, how-to-fix notes, fast solutions

How to open html pages without .html

If your site uses links like http://domain.com/testpage.html and http://domain.com/demo.html, and you want them to open like http://domain.com/testpage and http://domain.com/demo, you can use this solution. Go through FTP or a File Manager to the folder with the site files. Open file .htaccess and add the following code: RewriteEngine on RewriteBase / …

Read More »

How to add 301 redirect to https for Yii2 without .htaccess

I’ve tested different redirect options for .htaccess, but sites keep giving “redirected you too many times” error. Here is the working code to solve the problem. In the file /config/web.php you need to find: 'bootstrap' => [ 'log', 'app\components\Bootstrap', ], and place below: 'on beforeRequest' => function ($event) { if(!Yii::$app->request->isSecureConnection){ …

Read More »

Show and hide block with js

Few examples for showing a block on button click. Example 1: easy to use <script type="text/javascript"> function openlink(id){ display = document.getElementById(id).style.display; if(display=='none'){ document.getElementById(id).style.display='block'; }else{ document.getElementById(id).style.display='none'; } } </script> The block will be opened by clicking on the link: <a href="#" onclick="openlink('mylink'); return false">Open the link</a> Content will be shown when …

Read More »