404 error after changing permalinks wordpress

2019-03-16 09:46发布

问题:

My site is a Wordpress-site created with PHP.

I have made changes in permalink default to postname. It works fine in Chrome and Firefox but not in IE8. The front page displays correctly but when I click a link to another page, it shows a 404 page not found error.

I'm using Wordpress version 3+.

.htaccess file is

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

where WordPress is folder name. also in apache rewrite_module is enable

回答1:

First put a .htaccess file in your /var/www/ folder and make it writable. Second, suppose your wordpress blog is in /var/www/blog folder then go to /etc/apache2/sites-available/ and make following changes in default file

<Directory /var/www/>
    Options +ExecCGI 
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
</Directory>
<Directory /var/www/blog/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
</Directory>

Now restart apache to make sure changes have taken effect. Hope it helps.



回答2:

After trying all of these answers and the instructions on codex.wordpress.org, I needed to enable mod_rewrite on Apache: https://stackoverflow.com/a/5758551/728287



回答3:

Just go into wordpress /wp-admin, which will still work, and navigate to settings->permalinks. When you go to that page, wordpress will rebuild your .htaccess file and everything will work again.

EDIT (FROM http://codex.wordpress.org/Using_Permalinks)

If the above does not work:

Paged Navigation Doesn't Work

Sometimes navigation to second (and subsequent) pages of posts does not work as expected.

The result of clicking one of those links is that the page loads with all the surroundings (header, footer, sidebar), but instead of a page of posts, there is an error message: "Sorry, no posts match that criteria."

This is due to a glitch in the .htaccess file that WordPress generates. To fix it, delete the contents of your .htaccess file and re-create it.

In the Control Panel, go to Manage > Files (More Info on Editing Files)

Click the link to your .htaccess file to edit its contents

Copy the contents of the file and paste it to a text file in a text editor. This is a precaution in case your .htaccess file has manual entries for redirects, denials or other handy htaccess tricks

Delete all contents from your .htaccess file and click the Update File button.

In the Control Panel, go to Options > Permalinks.

Click the Update Permalink Structure button to freshly generate new rewrite rules for your permalinks.

Test the results using a link that had previously broken.

Add any manual htaccess entries back in your file (Place manual htaccess entries before the # BEGIN WordPress or after # END WordPress lines.)

You may also perform similar steps by deleting the .htaccess files from the server, creating a fresh empty .htaccess file, changing its permissions to 666, and then in Options -> Permalinks generate a new set of htaccess rules by clicking the Update Permalinks Structure button.

If that still doesn't work, take a look at the WordPress support forums, specifically http://wordpress.org/support/topic/permalink-nextpage-doesnt-work#post-283222



回答4:

I had the same issue locally, I tried everything above. After a while I realised how the vhost is setup for the application the .htaccess is not enabled.

<Directory "/Applications/XAMPP/htdocs/wordpress">
    Options FollowSymLinks
    AllowOverride All

    Order allow,deny
    Allow from all
</Directory>

Adding these lines, helped me a lot and resolved my issue.



回答5:

Enable rewrite_module in Apache-> Apache Moduels



标签: php wordpress