PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, February 14, 2022

[FIXED] Permalinks don't work on WordPress installation on MAMP.

 February 14, 2022     .htaccess, apache, mamp, php, wordpress     No comments   

Issue

I followed this guide for installing WordPress multisite on MAMP: http://perishablepress.com/wordpress-multisite-mamp/

And it seems to be working fine. I can access WordPress admin, and the site itself. However, whenever I create a page and try to visit it, I get an 404 error, as if the permalink url is broken or something, but I can't figure out what's wrong.

Example:

  • mysite.domain.local <-- Works
  • mysite.domain.local/wp-admin <-- Works
  • mysite.domain.local/page1 <-- Doesn't work, even if I have created the page "Page1"

My htaccess file looks like this, in accordance with the guide I followed:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
RewriteRule . index.php [L]

Solution

You can remove your custom-edit from your .htaccess file and edit the permalinks settings (i.e. revert to default), save the changes. This way Wordpress will be forced to re-generate it (if it has any errors) and everything should work.

This .htaccess file should be located in root of your Wordpress installation (you may have other .htaccess files in sub-folders as well).



Answered By - Bud Damyanov
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing