Mac OSX – Redirect .htaccess is not working ?

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

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.

Comments

avatar
2 Comment threads
0 Thread replies
1 Followers
 
Most reacted comment
Hottest comment thread
2 Comment authors
Sohail RahimCarol Recent comment authors
newest oldest most voted
Sohail Rahim
Guest
Sohail Rahim

Thanks. This worked for me

Carol
Guest
Carol

Hi, is there any way to get the latest posts through e-mail?
joining an email subscription?
Thanks in advance