WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Moved to a new server, permalinks no longer working (11 posts)

  1. attetude
    Member
    Posted 4 years ago #

    Hi!

    I recently moved my WordPress installation from my hosting account (Servage) to a different account on same virtual hosting provider. Took a copy of database, copied files and so on, domain remains the same. Now, the problem is that I cannot get the permalinks to work. If they are enabled, trying to load them just results in 404 error. If I enter an oldschool URL, for example /?page_id=69, the redirect happens but 404 shows up again.

    What I have tried is to update permalink structure, and removing .htaccess and then updating permalink structure creating a new one. The settings in Servage CP for virtual host are exactly the same as before. Without permalinks, the site works correctly.

    So, where should I start addressing this problem?

    Thank you.

  2. e-sushi
    Member
    Posted 4 years ago #

    So, where should I start addressing this problem?

    In the fact that wordpress does store absolute paths in it's database in some places. Some plugins do the same. This is bad because if your local webserver directory path changes, some stuff goes bezerk.

    As far as I know, wordpress never said that you can just copy-and-paste it somewhere else.

    This is my usual ritual:
    1. backup database AND export wordpress xml data
    2. backup '/wp-content/' and everything in it
    3. leave that server
    4. say hello to new server and install a fresh wordpress on it.
    5. copy the '/wp-content/' to where it belongs
    6. import the exported wordpress xml data

    7. if, and only if the exported wordpress xml data fails to import, try to recover from the database backup. Being rather pro, I import table after table and not the whole mysql file... so if anything breaks, I know where to look.

    Sooo... after a long excerpt, my 2 cents is to look at (a) the '.htaccess' file to see if it's ok. Then (b) check 'wp-config.php' just in case someone configured an absolute path in there and then (c) tiptoe throught the database and correct invalid local path references.

  3. e-sushi
    Member
    Posted 4 years ago #

  4. attetude
    Member
    Posted 4 years ago #

    Thanks for your help. I did the following:

    a) .htaccess file seems to be fine and is generated properly after deleting and updating permalinks
    b) No absolute path defined in wp-config
    c) I did a quick search through the database, and only absolute path reference I could find was in upload_path, which I changed -> no effect. (I'm using phpMyAdmin, and I suppose that using the search function with part of the path should find the local path references?)

    Also, though I'm sure nothing is usually stored in .php files, I searched contents of the files of the installation directory with part of the path, and no results.

    Any other ideas or suggestions if I did something wrong. :)

    I guess I misinterpreted(?) this part:

    If you are moving WordPress from one server to another, begin by backing up your data. This includes backing up your WordPress database as well as all the core files, images, plugins, and other files on your site. See WordPress Backups and Backing Up Your Database for more details.

    * Note: If you are changing to a new server but same domain, all you need to do is edit wp-config.php and upload everything as it is to your new server.

  5. Shane G.
    Member
    Posted 4 years ago #

    Hi,

    Refer this article:

    http://codex.wordpress.org/Moving_WordPress#Moving_WordPress_to_a_New_Server

    Also reset the permalink from the wordpress admin area and add this code in htaccess:

    # BEGIN WordPress
    
    <IfModule mod_rewrite.c>
    ErrorDocument 404 /index.php?error=404
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    Thanks,

    Shane G.

  6. e-sushi
    Member
    Posted 4 years ago #

    If You Don't Care If Your Old Blog Works

    1. Download a copy of the main wordpress files from your OLD blog to your hard drive and edit wp-config.php to suit the new server.
    2. Go back to your OLD blog and go to options and change the url (both of them) to that of your new site.
    3. Again, download your database (but keep the old one just in case), upload this new database and the copy of the wordpress core files with the edited wp-config.php to your new server. Thats it!

  7. e-sushi
    Member
    Posted 4 years ago #

    I bet you missed the "change the url (both of them) in the options" part before you downloaded your database backup? Then check the urls using phpmyadmin too... you never know. ;)

  8. attetude
    Member
    Posted 4 years ago #

    Hmm, but the domain remains the same, so I really shouldn't change the URL to something else?

  9. e-sushi
    Member
    Posted 4 years ago #

    Just said to check the domain settings to make sure everything is in place there too. Hmmm, I must admit I can't think of much more without looking at the problem directly... unless a file got corrupted during the move and now causes problems (but a 404 would be not logical), I'm out of ideas. Sorry!!! I'll better step aside now to make room for someone that will hopefully be able to solve your issue. Good luck! 8}

  10. attetude
    Member
    Posted 4 years ago #

    Thanks anyway.

    It is possible that there is something wrong with hosts settings, as WordPress seems to be really configured properly... We did make the configuration yesterday, but currently I don't have access to the account to make a triple check, so I will update after I get in contact with the account holder of the host. My guess is that if .htaccess/mod_rewrite has been disabled on the host or not working properly, it causes WP to act this way and results in 404 errors?

  11. attetude
    Member
    Posted 4 years ago #

    There was a problem with server configuration and .htaccess (and also a big delay with configuration changes going actually live which also confused things a bit more). I should always start with the simplest solution there is. ;)

Topic Closed

This topic has been closed to new replies.

About this Topic