WordPress custom pretty permalinks in MAMP (Mac)

MAMP is a web server for Mac. I use it for WordPress theme development. Out of the box, MAMP does not support WordPress custom URL formats (called clean URLs or pretty permalinks).

While not a deal breaker, it can be irritating at times, for example, when you look at the local blog to get a URL that is to be hard-coded into the theme.

A number of fixes might be required, depending on the state of your Mac, MAMP install and WordPress.

1. Enable mod_rewrite
Open httpd.conf file from /MAMP/conf/apache/ and look for the line below:

#LoadModule rewrite_module modules/mod_rewrite.so

Uncommend the line by removing the pound sign (#) at the start of the line.

2. Enable Symlinks
By default, .htaccess is hidden on Mac. If you use a code editor (Textmate, Textwrangler etc.) or FTP app (Transmit, Cyberduck etc.), use it to navigate to root of your hard disk, where the file will be visible. Alternatively, you can use this terminal command to show hidden files.

Add the code below to the .htaccess in the root of your WordPress install (ie. the folder which contains wp-includes).

Options +FollowSymLinks

Edit .htaccess file
First, go to Settings > Permalinks and set the desired permalink format. Then, open .htaccess file in the root of your WordPress install and add this:

# BEGIN WordPress

ErrorDocument 404 /index.php?error=404
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]


# END WordPress

Please write a comment below if this worked for you, if you have any problem, or for suggestions.

Leave a Reply

© Techzilo 2020 All Rights Reserved.

preloader