简体   繁体   中英

The permalinks in WordPress returns 404

I imported a wordpress production website into my local server to modify it and learn how to wordpress. I use LAMP and my WordPress project is located on a different Hard Drive than my Ubuntu 16.04 partition. But even if I can access to the main page, all the other links (except /wp-admin) are returning a 404 not found error.

As I could read, the problem could be that the .htaccess file was not read by apache2. To enable this option, I needed to enable the plugin rewrite with sudo a2enmode rewrite and to change in /etc/apache2/sites-enabled/000-default.conf the :

<Directory /var/www/html>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
</Directory>

by :

<Directory /var/www/html>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
</Directory>

If this may correct the error 404, it creates an internal server error...

Is anyone have an idea of how to handle this problem ?

Thank you !

Have you flushed the rewrite rules yet?

Go to Settings -> Permalinks and hit save.

Alternatively, you can do it from your theme by calling the flush_rewrite_rules() function.

当我需要为每个开发项目使用其他硬盘上的目录时,我更改了Apache2的服务器根目录,从而解决了我的问题

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