wordpress - Issue in Updating the IP in DB -
we encountered below listed issue while migrating our company site new site following steps below:
- we have launched new amazon rds instance , imported data old db new rds.
- we pointed website newly launched rds
- assigned new elastic ip address wordpress site , ip of instance got change.
- ran query update new ip in database level
but after executing query prod site still pointed old ip.
fix:
- we have taken db dump in .sql format , analysed. found old url still hard coded in db
- so have edited .sql dump replacing old url new url. , imported edited dump db. after import , restarting, application started working fine.
could please let me know (1) whether such hard coding ip common practice in wp , (2) there better way avoid hard coding?
thanks in advance!
wordpress not store server ip address in database, does store full url site in many places.
it sounds must using ip address access website, meaning people visit site going http://xxx.xxx.xxx.xxx , not http://www.example.com, explain why ip address being stored in database.
when migrating new domain name, have search , replace database instances of old domain new domain. preferable use tool wp-cli search-replace task because account serialized array data can become corrupted if simple find , replace in text editor. tool allow skip columns, 'guid' column, might want keep when migrating domains.
currently, there no "better way" avoid hard-coding site url in database since default wordpress behavior. you can read more in wordpress handbook here, explains why absolute urls stored in database.
Comments
Post a Comment