Jump to content

Archived

This topic is now archived and is closed to further replies.

jfsturtz

[Solved] Site lost styling on move from one location to another

Recommended Posts

jfsturtz

Just tried to move a site from one location to another on the same server (i.e., I'm just changing the URL), and now the site in the new location has lost all styling.

I followed the steps listed here:

https://codex.wordpress.org/Moving_WordPress

under Moving Directories On Your Existing Server.

After the move, I was able to log in to WordPress at the new site just fine.  I went and updated the Permalinks.  I checked all the media and menu links, and they appear to have updated fine.  Then I loaded the DMS editor, and the site came up fine.  But when I tried to Publish, it hung (it said Saving in the lower right, but the little spinning arrows just kept going around endlessly).  Possibly I was overly impatient, but I waited quite awhile and it never seemed to finish saving for several minutes.

So I terminated Chrome and started it back up again.  Now when I try to edit the site with DMS, it looks like the picture below, and the editor doesn't come up.  I've deactivated all plugins, but it didn't help.

Help.  I hope I haven't hosed things up badly ...

Thanks.

/John

SNAG-15110520291300.png

Share this post


Link to post
Share on other sites
jfsturtz

Just tried it again, with a test site (that is much smaller, and I don't care if I lose its contents).

Although the DMS editor didn't seem to hang this time, the result is the same:  the page lacks styling when viewed outside the DMS editor.  (And to boot, I turned off the DMS editor and now can't turn it back on, as the Activate PageLines Editor button is inactive).

URL for this site is here:  http://www.sturtz.org/john/mv-test

It may be easier to diagnose the problem at the smaller site ...

/John

Share this post


Link to post
Share on other sites
jfsturtz

Update:

Unable to contain my curiosity, I mucked around with the test site a little more.  Basically, what I did was get on the server and use mysql to set the siteurl and home properties to point back to the original URL.  Logged in to the site (back in its original location), started up DMS, and everything is fine.  All the content is still there and intact.  It just doesn't work when moved to a new location.

So the link I posted above (http://www.sturtz.org/john/mv-test) is no longer in operation, as I've set it back to the original URL.

The other (real) site -- http://www.norwegiangleeclub.com -- is still in its new location and nonfunctional, as I posted originally.

Which brings to mind one thing:  There is one small way in which I deviated from the instructions given at the WordPress Codex.  When I got to Step 8 (Move your WordPress core files to the new location), I didn't move them; I copied them (so left a copy intact in the original location).  Didn't think that would hurt anything, but maybe it does?

/John

Share this post


Link to post
Share on other sites
Simon

did you copy the uploads folder?

Can you log into the site? If you can go to the wp-admin PageLines settings and click save to regenerate the css

Share this post


Link to post
Share on other sites
jfsturtz

Simon:

I did copy the uploads folder.  wp-content/uploads/pagelines contains two .css files (compiled-css-core-[0-9]*.css and compiled-css-sections-[0-9]*.css).

I can log in to the site, and did go to the PageLines admin page and click the button that says 'Save LESS'.  I just tried it again.  It didn't seem to help.

dreamsight:

I wasn't aware of the duplicator plugin.  I'll give it a try with the test site.

Thanks!

/John

Share this post


Link to post
Share on other sites
jfsturtz

I note with some confusion the following facts:

That directory (wp-content/uploads/pagelines) contains four .css files in the old location -- two compiled-css-core files, and two compiled-css-sections files (the file names differ only in the sequences of digits prior to the .css).  Not sure how that happened.  When I copied the content from the old location to the new, the way I did it was to tar it up, and then untar it in the new location.  I just looked at the tar file, and only two of the .css files are in it.  I'm not sure where the other two came from that are now in the old location.

The other thing is:  In the old location, the .css files are owned by user apache.  In the new location, they are owned by me.  Suppose that matters?

/John

Share this post


Link to post
Share on other sites
jfsturtz

Seems to be a file ownership/permission problem.  Although I can't change the ownership of the .css files to apache (I don't have permission on the server to do that), I can change the permissions (since I own them) so that anyone has the same access to them that I do.  Once I did that (to the .css files, and also the entire directory chain leading down to them), everything seems to work fine again ...

Share this post


Link to post
Share on other sites
Simon

So is the ownership of the files you are copying apache? or you need to change them to apace on the new server?

Share this post


Link to post
Share on other sites
jfsturtz

Both the original location and the new location are on the same server, just different directories.

In the original directory, where I originally installed WP and developed the site, all the files in the WP installation are owned by me (my username on the server is the admin for the site) except wp-content/uploads (and all its recursive contents), which is all owned by apache (files and directories).

When I copied the contents to the new directory, I extracted it all from the tar file I created, and it re-created the directory structure.  But since I ran the un-tar process while logged in as myself, all the files ended up being owned by me (including the compiled-css-core and compiled-css-sections CSS files in wp-content/uploads/paglines).  Resulting site in the new location lacked styling, and the DMS editor wouldn't work.

I don't have rights on the server to chown the CSS files to apache.  But since I own them, I can change the permissions.  As soon as I changed them to 777 (as well as all the directories leading up to them), the site appeared normal, and the DMS editor worked again.  (At some point after that, ownership of the CSS files became apache in the new location as well; I presume it must be the DMS editor that did that.  But not until I was able to run it ...)

All seems to work as expected in the new location now except that I have been unable to make any Permalink setting work except the Default.  I've read about a million forum posts on this topic (here, and in WP forums), but I've been unable to figure out what's wrong.  I've gone to the Settings page and regenerated the Permalinks with one of the prettier options (Post name).  The WP installation in the new location does have a .htaccess file, it is being written to, and it contains what I believe are the correct contents.  But trying to access any page other than Home always results in 'The requested URL /xxx/yyy/ was not found on this server.'

Sigh.

Share this post


Link to post
Share on other sites
Simon

I would be questioning the reason for running it as user apache.

The reason the files are owned by apache when written is because that is the process that is running PHP. This is often the case on shared servers as the process can run mod_php and its very quick, however its also insecure and all files are owned by apache.. 

You cannot change permalinks because the PHP process is not allowed to write a .htaccess file, again permissions issue. 

If it is a VPS or dedicated server you might consider nginx and php-fpm. it is a lot faster than apache, smaller.. and php will run as your user not apache.

Share this post


Link to post
Share on other sites
jfsturtz

Hm.  I wondered about that.  In nosing about on various forums researching, I found widespread opinion that apache shouldn't own the files.  What ought the effective UID of the process be?  Mine (i.e., the ID of the site admin, which is also my username on the server)?

The server in question is owned by my nephew, who runs a (very small; largely just for friends and family) ISP.  (The advantages are that I have capability to log on to the server and do things I wouldn't have with many ISP's, and if I have trouble, I can just e-mail or text him.  The disadvantage is that things aren't always done in the usual way).  I can certainly discuss this with him.

But two things I don't understand:

  1. Why are most of the files (which I also created through WP admin, logged in as myself = the site admin) owned by me?  But only these few are owned by apache?
  2. It can't merely be a matter of user apache being unable to write the .htaccess file.  Because it is.  When I change Permalink settings through the WP admin page, I can see that the contents of the .htaccess file have changed.  When I set Permalinks to 'Post name' (what I typically use), the .htaccess file does get updated with the contents that I believe it should contain (see below).  But I still get the error messages about requested URL not found.

/John

 

Contents of .htaccess file after changing Permalinks to 'Post name' through WP admin page:

# 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

Share this post


Link to post
Share on other sites
Simon

maybe you dont have the mod_rewrite module enabled.

Share this post


Link to post
Share on other sites
jfsturtz

If that were so, the pretty Permalinks wouldn't work anywhere on the server.  But they do.  All my other WP/Pagelines sites are also on this server.  Including the site in question, in its original location.  And it worked fine there.  It only broke when I moved it to the new location.

It's academic, to some degree.  The site works fine without the pretty Permalinks.  I just don't understand why it works in one location but not in the other, when there's a (seemingly) valid .htaccess file in both locations.  There must be more to it, that I just don't grok.

Share this post


Link to post
Share on other sites
Simon

You are using a pretty nonstandard install of apache.

Seriously read up on nginx and php-fpm.. its easy to setup and easy to add sites.. you dont even need rewrites, it all just works.

Share this post


Link to post
Share on other sites
jfsturtz

I'll inquire.  Still, I don't understand why it doesn't work as it is, and I wish I did.

Anyway, it doesn't seem to be a Pagelines issue so much as a WordPress issue.  So it's probably not your responsibility.  Thanks for sticking with me on it this far.

/John

Share this post


Link to post
Share on other sites
jfsturtz

FYI.  Problem was this:  Although mod_rewrite was enabled on the server, the pertinent Apache config did not apply to all sites on the server (yes for the URL I originally developed the site under; no for the URL I moved the site to).  Once I alerted my nephew to the problem and he updated the Apache config, all was well.

Thanks for the help!

/John

Share this post


Link to post
Share on other sites
Simon

This topic has been marked as solved and therefore closed.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×