STS Host and Tech Knowledge base
Search
Close this search box.

How to remove Byte order mark from PHP htaccess or others

In this article we will learn how to remove  byte order mark.

What is Byte order mark (BOM)?

Byte order mark is the informal name of the special 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

For example: when you change a 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. Now your website may not work and it will show 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)

Login to your Linux Server using PuTTY SSH and run the following command.

				
					vi .htaccess
				
			

Then enter the command to remove the BOM:

				
					:set nobomb
				
			

Save the file:

				
					:wq
				
			

Once you run the saved command ,check the file online and the problem should be solved.

Share Article

Related Articles