500 Internal Server Error when using .htaccess with RewriteEngine

\xef\xbb\xbf are three invisible junk characters (at least from Apache's perspective) called the Unicode BOM, or byte order mark. Apache thinks that those characters are part of the command that follows right after. This is what you see in the log, though the characters are escaped so they're visible to the naked eye. \xef\xbb\xbfRewriteEngine

In your editor, especially if your editor is Notepad, make sure you're saving your file without a BOM. This should be selectable in the save as dialog or elsewhere.


To remove the BOM in unix use vi and below command

: set nobomb

: wq


It might be the mod_rewrite module is not loaded.

Windows xampp : Open xampp/apache/conf/httpd.conf and uncomment mod_rewrite module.
Windows wamp : Open wamp/bin/apache/Apache2.x.x/conf/httpd.conf and uncomment mod_rewrite module.
Ubuntu : a2enmod rewrite && service apache2 restart or cp /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load

Then reload apache


Try this:

a2enmod rewrite    
/etc/init.d/apache2 restart