After migrating wordpress to digital ocean, only homepage and admin work

May 27, 2017 661 views
WordPress Apache Ubuntu 16.04

Hello, I have been having an issue with my WordPress site that I have just migrated from a local server. The homepage and the admin pages work, but none of the other pages work. they all return a 404 not found error. I have checked that the permalinks are properly set up. I can edit the pages, and it displays the proper permalinks on the admin side. This is my htaccess file

# 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>

# END WordPress

is there anything wrong here?
I've enabled mod_rewrite in apache. Any suggestions are greatly appreciated!

3 Answers

@tommyconner96

From the CLI, please run:

tail -20 /var/log/apache2/error.log

Once you execute that command, copy and paste the output to a code block as you did with your .htaccess file. We can then take a closer look to see if there's anything being logged that'll help us to find the cause of the issue.

  • [Sat May 27 16:00:05.694530 2017] [:error] [pid 7992] [client 172.56.11.10:22368] PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/wp-content/themes/cherryframework4/lib/classes/class-cherry-optionsframework.php on line 136, referer: http://174.138.58.51/wp-admin/admin.php?page=options
    [Sat May 27 16:00:05.694553 2017] [:error] [pid 7992] [client 172.56.11.10:22368] PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/wp-content/themes/cherryframework4/lib/classes/class-cherry-optionsframework.php on line 136, referer: http://174.138.58.51/wp-admin/admin.php?page=options
    [Sat May 27 16:00:05.694597 2017] [:error] [pid 7992] [client 172.56.11.10:22368] PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/wp-content/themes/cherryframework4/lib/classes/class-cherry-optionsframework.php on line 136, referer: http://174.138.58.51/wp-admin/admin.php?page=options
    [Sat May 27 16:00:05.694636 2017] [:error] [pid 7992] [client 172.56.11.10:22368] PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/wp-content/themes/cherryframework4/lib/classes/class-cherry-optionsframework.php on line 136, referer: http://174.138.58.51/wp-admin/admin.php?page=options
    [Sat May 27 16:00:05.694669 2017] [:error] [pid 7992] [client 172.56.11.10:22368] PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/wp-content/themes/cherryframework4/lib/classes/class-cherry-optionsframework.php on line 136, referer: http://174.138.58.51/wp-admin/admin.php?page=options
    [Sat May 27 16:00:05.694711 2017] [:error] [pid 7992] [client 172.56.11.10:22368] PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/wp-content/themes/cherryframework4/lib/classes/class-cherry-optionsframework.php on line 136, referer: http://174.138.58.51/wp-admin/admin.php?page=options
    [Sat May 27 16:00:05.694736 2017] [:error] [pid 7992] [client 172.56.11.10:22368] PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/wp-content/themes/cherryframework4/lib/classes/class-cherry-optionsframework.php on line 136, referer: http://174.138.58.51/wp-admin/admin.php?page=options
    [Sat May 27 16:00:05.694779 2017] [:error] [pid 7992] [client 172.56.11.10:22368] PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/wp-content/themes/cherryframework4/lib/classes/class-cherry-optionsframework.php on line 136, referer: http://174.138.58.51/wp-admin/admin.php?page=options
    [Sat May 27 16:00:05.694805 2017] [:error] [pid 7992] [client 172.56.11.10:22368] PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/wp-content/themes/cherryframework4/lib/classes/class-cherry-optionsframework.php on line 136, referer: http://174.138.58.51/wp-admin/admin.php?page=options
    [Sat May 27 16:00:05.694883 2017] [:error] [pid 7992] [client 172.56.11.10:22368] PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/wp-content/themes/cherryframework4/lib/classes/class-cherry-optionsframework.php on line 136, referer: http://174.138.58.51/wp-admin/admin.php?page=options
    [Sat May 27 16:00:05.694911 2017] [:error] [pid 7992] [client 172.56.11.10:22368] PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/wp-content/themes/cherryframework4/lib/classes/class-cherry-optionsframework.php on line 136, referer: http://174.138.58.51/wp-admin/admin.php?page=options
    [Sat May 27 16:00:05.694932 2017] [:error] [pid 7992] [client 172.56.11.10:22368] PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/wp-content/themes/cherryframework4/lib/classes/class-cherry-optionsframework.php on line 136, referer: http://174.138.58.51/wp-admin/admin.php?page=options
    [Sat May 27 16:00:05.694952 2017] [:error] [pid 7992] [client 172.56.11.10:22368] PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/wp-content/themes/cherryframework4/lib/classes/class-cherry-optionsframework.php on line 136, referer: http://174.138.58.51/wp-admin/admin.php?page=options
    [Sat May 27 16:00:05.694971 2017] [:error] [pid 7992] [client 172.56.11.10:22368] PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/wp-content/themes/cherryframework4/lib/classes/class-cherry-optionsframework.php on line 136, referer: http://174.138.58.51/wp-admin/admin.php?page=options
    [Sat May 27 16:00:05.695026 2017] [:error] [pid 7992] [client 172.56.11.10:22368] PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/wp-content/themes/cherryframework4/lib/classes/class-cherry-optionsframework.php on line 136, referer: http://174.138.58.51/wp-admin/admin.php?page=options
    [Sat May 27 16:00:05.695061 2017] [:error] [pid 7992] [client 172.56.11.10:22368] PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/wp-content/themes/cherryframework4/lib/classes/class-cherry-optionsframework.php on line 136, referer: http://174.138.58.51/wp-admin/admin.php?page=options
    [Sat May 27 16:00:05.695093 2017] [:error] [pid 7992] [client 172.56.11.10:22368] PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/wp-content/themes/cherryframework4/lib/classes/class-cherry-optionsframework.php on line 136, referer: http://174.138.58.51/wp-admin/admin.php?page=options
    [Sat May 27 16:00:05.695137 2017] [:error] [pid 7992] [client 172.56.11.10:22368] PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/wp-content/themes/cherryframework4/lib/classes/class-cherry-optionsframework.php on line 136, referer: http://174.138.58.51/wp-admin/admin.php?page=options
    [Sat May 27 16:00:05.695162 2017] [:error] [pid 7992] [client 172.56.11.10:22368] PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/wp-content/themes/cherryframework4/lib/classes/class-cherry-optionsframework.php on line 136, referer: http://174.138.58.51/wp-admin/admin.php?page=options
    [Sat May 27 16:00:05.695183 2017] [:error] [pid 7992] [client 172.56.11.10:22368] PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/wp-content/themes/cherryframework4/lib/classes/class-cherry-optionsframework.php on line 136, referer: http://174.138.58.51/wp-admin/admin.php?page=options
    tommy@renew1:~$
    
    

    cherry framework is the theme that I am using. Not sure if those errors are related to none of the pages loading. Here is line 136 of class-cherry-optionsframework.php if that is relevent at all

                    foreach ($sectionSettings['options-list'] as $optionId => $optionSettings) {
    
    • @tommyconner96

      To make sure it's not the theme causing the issue, have you tried temporarily changing the theme to one of the WordPress defaults, such as 2016 or 2017? If not, I'd try that since you are seeing a warning being logged.

      If everything works when switching to one of the defaults, then the issue is definitely with the theme and you would need to get in touch with the theme authors to see if they can push a fix that you can download and apply.

Provide your site URL + likely someone can assist you.

<IfModule mod_rewrite.c>

Please make sure your mod rewrite is enabled and that you allow override in the vhost for the site.

https://www.digitalocean.com/community/tutorials/how-to-set-up-mod_rewrite

by Etel Sverdlov
This tutorial goes over Mod_Rewrite, an apache module that allows you to manipulate URLS to provide shorter or more relevant ones. This tutorial will go over Activating Mod_Rewrite, Creating and Using the required .htaccess page, and setting up the URL rewrites.
Have another answer? Share your knowledge.