Apache

How to remove Byte order mark from PHP htaccess or others

What is Byte order mark (BOM)

According to W3C definition BOM is Unicode character encoding that appear as a magic number at the start of a text file or any other file types. or consider it as representation for the UTF-8 BOM in ISO-8859-1

Error Case Scenario

Sometimes you may change file using different editor software and upload that file to your website like “.htaccess or php” then on browsing the website you are getting

public_html/.htaccess: Invalid command ‘\xef\xbb\xb’, perhaps misspelled or defined by a module not included in the server configuration . Because of this error your website may not work and showing Error 500 . even if you are trying to edit the file in normal editor you wont be able to find out and remove those BOM

Remove Byte order mark (BOM)

you can login to your Linux Server using PuTTY SSH and run the following command
    
     vi .htaccess
    
   
And enter the command to remove the BOM:
    
     :set nobomb
    
   
Save the file:
    
     :wq
    
   
After running the saving command you can check the file online and the problem should be solved.
XsoftHost Support

Share

Recent Posts

Add Extra IP addresses to server configuration On Ubuntu 17.10 and later

Each failover IP address will need its own line in the configuration file. The configuration…

4 years ago

Create RAID Arrays with mdadm on Ubuntu

What is mdadm? The mdadm utility can be used to create and manage storage arrays…

4 years ago

How to change the maximum upload file size for PHP

There are several scenarios that you might need to increase or decrease your php maximum…

6 years ago

How to install Let’s Encrypt Plugin in WHM/cPanel

What is Let’s Encrypt? Let’s Encrypt is a free certificate authority provided by the Internet…

6 years ago

How to install python in my cPanel and add py extension

Python normally installed on all cPanel hosting server because most of Centos/red hat update system…

6 years ago

How to install and enable GUI GNOME Desktop on centos 7

Usually CentOS 7 comes in a numbers of variants, For most users, there are two…

6 years ago