Here is the .htaccess file.

/Library/WebServer/Documents/.htaccess

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /mkyong/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /mkyong/index.php [L]
</IfModule>

# END WordPress

Solution

Find the Apache config file in /etc/apache2/httpd.conf, make sure the following settings are configured properly :

1. The mod_rewrite.so is loaded.
2. In the Directory tag, update AllowOverride to all (default none)

sudo vim /etc/apache2/httpd.conf

# Make sure below module "mod_rewrite.so" is loaded.
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
LoadModule php5_module libexec/apache2/libphp5.so
#LoadModule perl_module libexec/apache2/mod_perl.so
LoadModule hfs_apple_module libexec/apache2/mod_hfs_apple.so

#...

DocumentRoot "/Library/WebServer/Documents"
<Directory "/Library/WebServer/Documents">
    #...

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride all

    #...
</Directory>

References

  1. Apache – Mapping URLs to Filesystem Locations
  2. Apache HTTP Server Tutorial: .htaccess files