Horje
How do I set SITE_URL to override the database url info?  - Wordpress Solution
So I am at a company and I was asked to set up a new blog. First, I went to: dev.site2.mysite.com Which is part of the dev site. I installed the blog there, activated, and imported some content from an older blog. Then I committed it to git. Then I realized I had committed it to the wrong folder, which also maps to the wrong sub-domain. So I move it to: dev.public.mysite.com Then I commit this to git, merge to the master branch, and we push it out to our staging server, which is at: admin.mysite.com I look at the site and the CSS and JS are broken, because they seem to be hardcoded to: dev.site2.mysite.com I thought I could override this in the wp-config.php file so I open it and do something like: define('WP_HOME', 'http://www.mysite.com'); define('WP_SITEURL', 'http://www.mysite.com'); which did not work, even when pushed out. It seemed to have no effect -- the style sheets are still linking to dev.site2.mysite.com. Also, I need these variables to match the many sub-domains we have (we have a complicated and multi-stage development and staging and testing platforms). So I fetched some info from $_SERVER and made this a variable: define('WP_HOME', $server_base_uri . '/blog/'); define('WP_SITEURL', $server_base_uri . '/blog/'); But still, I commit this to the master branch in git, and we deploy to staging, but still, on staging, the style sheets and Javascript are hard-coded to dev.site2.mysite.com. I could probably muck around in the database and tear out any incidence of dev.site2.mysite.com, but I am curious if there is a way to do this so that these URLs automatically adjust to the many sub-domains we have? UPDATED: This is crazy. I got into this part of the dashboard: /wp-admin/options-general.php?settings-updated=true and I managed to reset WordPress Address (URL) and SITE URL, and yet when I reload the page, it still has the style sheets and javascript links hard-coded to dev.site2.mysite.com. And no, I have not yet installed any kind of cache plugin. UPDATED: Check out the screenshot that I am uploading. I can log into the dashboard and make some edits from there, but I don't get the header or footer.

Solution - 1

Have you tried updating it via your functions.php ? update_option('siteurl','http://example.com/blog'); update_option('home','http://example.com/blog');


Solution - 2

Hi Lawrence, The difference between this: define('WP_HOME', $server_base_uri . '/blog/'); define('WP_SITEURL', $server_base_uri . '/blog/'); And this: update_option('siteurl','http://example.com/blog'); update_option('home','http://example.com/blog'); Is the next. The first one defines a preprocessor directive that will override value in database but the second one change this value (the value is placed in wp_options).


Solution - 3

This sounds like it is clearly an issue with your database and serialized data that can be resolved a few different ways... With some clever mysql commands.. this probably won't work and you've probably tried it already but very carefully and painstakingly replacing urls on your .sql file (from the phpmyadmin export) in a text editor... and now I'm getting closer to an answer for you... I don't know how many database backups you have, but hopefully you have a backup of it from when everything was last working correctly, before migrating to a new domain. Each time you've changed the domain, updated the urls from the wp-admin dashboard or functions.php or phpmyadmin or text editor, your're adding complications to it.. you want to back track as far as possible so you have as few as possible variations in the urls you need to modify.. here is another possibility worth mentioning... Load the site and DB back up on the last url it was where it worked.. do an export of the contents, theme options and widgets (there is a nice plugin out there to download widget data in a json file - also some other plugins I've seen to download all your plugin settings and serialized data in a json file) Then install a new instance of wordpress and import all the data.. Okay finally here the possible best solution for you... Using the oldest .sql backup you have (to avoid all the URL changes and modifications you made in trying to solve the problem which are just making it worse) go to this url: [[LINK href="http://interconnectit.com/124/search-and-replace-for-wordpress-databases/"]][[/LINK]] http://interconnectit.com/124/search-and-replace-for-wordpress-databases/ Download and install the tool on your server (very easy) and run it.. This can swap out/replace your urls properly unlike a text editor and should hopefully fix the problem for you. If for some reason this doesn't work, I'd go back and try the second to last option I mentioned. :)


Solution - 4

Hi. I'm not sure if I uderstand well your problem, do you mean that you'v installed first the blog on dev.site2.mysite.com, the you'v moved it to dev.public.mysite.com and finally to admin.mysite.com, and the problem is that style sheets and javascript links are hard-coded to dev.site2.mysite.com? Please confirm. By the way, what about .htaccess file? maybe problem comes from there. Just a guess. Good luck.


Solution - 5

try to reactivate current theme. Or copy it to a new folder in wp-content/themes / and activate it.





Wordpress

Related
How do I make custom post types not appear as blog posts? - Wordpress Solution How do I make custom post types not appear as blog posts? - Wordpress Solution
Redirect exit page: Get external url from custom field - Wordpress Solution Redirect exit page: Get external url from custom field - Wordpress Solution
Problem with headway theme css - Wordpress Solution Problem with headway theme css - Wordpress Solution
Related posts within a taxonomy. - Wordpress Solution Related posts within a taxonomy. - Wordpress Solution
Decrease space - Wordpress Solution Decrease space - Wordpress Solution

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8