简体   繁体   中英

Wordpress localhost results in 404 pages when changing permalink structure to postname

I want to have my permalink structure to %postname% but doing so makes every page go to a 404 page where the requested URL cannot be found on the server. I'm using a mac and run my own development server using mac's php and apache. I followed this guide to get the server up: http://www.coolestguidesontheplanet.com/downtown/get-apache-mysql-php-and-phpmyadmin-working-osx-109-mavericks

These are the steps I took and none of them worked:

  1. Edited my htaccess

Options +FollowSymlinks
RewriteEngine on

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

# END WordPress
  1. Made sure rewrite engine is on for /etc/apache2/httpd.conf by uncommenting LoadModule rewrite_module libexec/apache2/mod_rewrite.so

  2. Also made sure AllowOverride was set to all.

The only way it will work somewhat is if I use a custom permalink structure and put index.php/%postname%/ but then all my pages will have a index.php in front of it and I don't want that.

Simple go to your WAMP folder. In WAMP go to bin; then apache. In apache there is a folder name conf; in conf there is a file name httpd. Open that file with note pad and find out this line #LoadModule setenvif_module modules/mod_setenvif.so

By removing hash from this line will enable the mod-rewrite function. Then you can use any custom permalinks for your site.

If need further help then let me know; I will send you a complete file or setup of WAMP.

@Mehreen's answer was so close to correct. I was having this issue as well, pulling my hair out.

Here's what you need to do: Go to wamp/bin/apache/apache[YourVersion]/conf Open up httpd.conf in notepad or whatever.

Do a search for both of these lines:

LoadModule setenvif_module modules/mod_setenvif.so

(and)

LoadModule rewrite_module modules/mod_rewrite.so

If there are hashes (#) at the start of these lines, remove them (this uncomments those lines), and those modules will be enabled.

Exit WAMP and restart. Presto!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM