Day: April 20, 2021

Step-1: Add 2 hidden fields to the contact form

[hidden your-first-name id:first-name-p]
[hidden your-last-name id:last-name-p]

Step-2: Write below jquery script in the footer

     str = $(this).val();
      s = str.split(/(?<=^\S+)\s/); //split string in name field after first space found. 
      $("#last-name-p").val(s[1]); //s[1] value after the first space set to hidden field.

Output will be list this:-

Chrome and Firefox have started showing insecure warnings on sites without SSL certificates. Without SSL, your website will show insecure to the visitors. Therefore, using an SSL-encrypted connection for safety, accessibility or PCI compliance reasons is necessary. It becomes very important to redirect from HTTP to HTTPS.

What is SSL?

SSL (Secure Sockets Layer) is a standard security protocol for establishing encrypted links between a web server and a browser in an online communication.

The usage of SSL technology ensures that all data transmitted between the web server and browser remains encrypted.

An SSL certificate is necessary to create SSL connection. You would need to give all details about the identity of your website and your company as and when you choose to activate SSL on your web server. Following this, two cryptographic keys are created — a Private Key and a Public Key.

Learn More: Why SSL is Critical?

In order to force your web traffic to use HTTPS, edit the codes in the .htaccess file.

Before we move onto redirecting HTTP to HTTPS, here’s how you can edit .htaccess file. If you already know skip to Redirection steps.

Editing .htaccess File

There are instructions/directives in the .htaccess file that tell the server how to act in certain scenarios and directly affects how your website functions. Common directives in .htaccess file:

  • Redirects
  • Rewriting URLs

Ways to edit an .htaccess file:

  1. Edit the file on your computer and upload it to the server using FTP.
  2. Use “Edit” mode in FTP program that allows you to edit a file remotely.
  3. Use a text editor and SSH to edit the file.
  4. Use the File Manager in cPanel to edit the file.

Editing .htaccess in cPanel File Manager

Note: Backup your website in case something goes wrong.

  1. Login to cPanel
  2. Files > File Manager > Document Root for:
  3. Now select the domain name you want to access
  4. Check “Show Hidden Files (dotfiles)”
  5. Click “Go”
  6. After a new tab or window opens, look for the .htaccess file.
  7. Right click on the .htaccess file and click on “Code Edit” on the menu.
  8. A dialogue box may pop up asking about encoding. Click “Edit” button to continue.
  9. Edit the file
  10. “Save Changes” when done.
  11. Test your website to make sure it is done correctly. In case, there is an error, restore to the previous version and try again.
  12. Once you are done, click “Close” to close the window.

Redirecting HTTP to HTTPS

1. Redirect All Web Traffic

If you have existing code in your .htaccess, add the following:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$$1 [R,L]

2. Redirect Only a Specific Domain

For redirecting a specific domain to use HTTPS, add the following:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$$1 [R,L]

3. Redirect Only a Specific Folder

Redirecting to HTTPS on a specific folder, add the following:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} folder
RewriteRule ^(.*)$$1 [R,L]

Note: Replace “yourdomain” with your actual domain name wherever required. Also, in case of the folder, replace /folder with the actual folder name.

Think it was helpful? Share this article to help others come on HTTPS.

On some occasions apache server will just fail, and become crashed, failing to restart with an error message like

# tail /var/log/httpd/error_log

[Sun Dec 22 10:05:27.006998 2013] [core:emerg] [pid 15001:tid 140145945569216] (28)No space left on device: AH00023: Couldn't create the fcgid-proctbl mutex
[Sun Dec 22 10:05:38.000403 2013] [core:emerg] [pid 15018:tid 140368783902656] (28)No space left on device: AH00023: Couldn't create the proxy mutex
[Sun Dec 22 10:05:38.000456 2013] [proxy:crit] [pid 15018:tid 140368783902656] (28)No space left on device: AH02478: failed to create proxy mutex

If you see an error similar to the bellow, it could indicate that your server has run out of semaphores. To see how many semaphores are being used, type the following command

# ipcs -s

------ Semaphore Arrays --------
key        semid      owner      perms      nsems
0x00000000 38797312   apache     600        1
0x00000000 38731777   apache     600        1
0x00000000 38830082   apache     600        1
0x00000000 38961155   apache     600        1
0x00000000 38895620   apache     600        1
0x00000000 38993925   apache     600        1
0x00000000 39026694   apache     600        1
0x00000000 39059463   apache     600        1
0x00000000 39092232   apache     600        1
0x00000000 39125001   apache     600        1
0x00000000 39157770   apache     600        1
0x00000000 39288843   apache     600        1
0x00000000 39223308   apache     600        1
0x00000000 39321613   apache     600        1
0x00000000 39354382   apache     600        1
0x00000000 39387151   apache     600        1
0x00000000 39419920   apache     600        1
0x00000000 39452689   apache     600        1
0x00000000 39485458   apache     600        1

To fix it and get Apache server started again, we must clean the semaphores. Run the following command to flush them:

for whatever in `ipcs -s | awk '{print $2}'`; do ipcrm -s $whatever; done

If that command may not work on older server then you may need to do the following

# /etc/init.d/httpd stop
# ipcs -s | grep nobody | gawk '{ print $2 }' | xargs -n 1 ipcrm sem
# /etc/init.d/httpd start

Final, you may want to increase the semaphore limits on your server. You can do that by adding the following to the /etc/sysctl.conf

kernel.msgmni = 512
kernel.sem = 250 128000 32 512

After, type the following command to update new setting for kernel

# sysctl -p