Wordpress 404 error on every page except homepage

2019-09-14 21:08发布

问题:

I have migrated my wordpress website from my desktop over to siteground for hosting. Prior to doing this I had been using free hosting at x10. The first time I transferred the site everything worked fine. The second time I tried (new version of the website) I found that every page except the home page had a 404 error (this was with x10). I then got hosting at siteground and am still having the exact same problem. Any solutions to this?

My .htaccess file

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

# END WordPress

回答1:

To fix it

  1. Login to /wp-admin
  2. Go to settings-> Permalinks
  3. and click on save changes button.


回答2:

when migrate a wordpress site, you should change the wp_options table siteurl and home url, then login to admin back end -> settings -> permalinks - set the permalinks and save,

Then you can set the .htaccess just set following code and test.

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


标签: wordpress