With the move from Prospress to Automattic a few months in the past, I thought it’s finally time to have my local development site reflect my new employer. Instead of using prospress.test
as my local development domain, I now want to use a8c.test
.
This is a relatively straightforward process, but I still wanted to make sure that I covered all of the details. I also wanted to make sure to document the process in case I need to change a site name again in the future. Here are the steps I took to accomplish the name change.
Change in the IDE
I wanted the IDE to recognize that the project name has changed in its own configuration files. This isn’t entirely necessary, but I like it for consistency.
- In IntelliJ, go to File > Project Structure.
- On the main “Project” tab, change the “Project name:” field value
- On the “Modules” tab, change the “Name:” field value
- Click OK to close the Project Structure dialog
- File > Close Project to close the project. Close any other open projects as well
- From the welcome screen where the most recent projects can be seen, hover over the project to change and click the “x” button to remove it from memory. This is because we’ll be changing the filesystem in the next section.
Filesystem
I like to use the terminal, so I’ll just document the commands I ran. All of my sites live in the ~/Sites
directory.
cd ~/Sites/prospress
valet unlink
cd ..
mv prospress a8c
cd a8c
valet link --secure
At this point, Valet+ should be ready to serve the ~/Sites/a8c
directory using https://a8c.test
.
WordPress
As I’ve written about elsewhere, I use a custom content directory to enable working with a trunk installation of WordPress. This adds an extra change to my wp-config.php
file, where I need to change the setting of the WP_CONTENT_URL
constant. The old value was https://prospress.test/content
and the new value is https://a8c.test/content
.
With that, I can use WP CLI to do a find/replace of all the old domain names:
wp search-replace 'prospress.test' 'a8c.test' --all-tables --precise
WooCommerce Subscriptions
WooCommerce Subscriptions has a great feature where it will detect a change to the site’s URL and automatically disable payments. The reason for this is that it’s assumed the site has been copied to a staging site, and as a store owner you wouldn’t want payments to be processed on a staging site.
When I open my wp-admin
screen, I see this notice:
Just clicking the “Enable automatic payments” button will reset the stored URL, and WC Subscriptions will be ready to work again.
IDE – Part 2
One final change that needs to be made in the IDE is for Xdebug. Go to Preferences > Languages & Frameworks > PHP > Servers. Here I need to change the “Host” and “Name” fields to use a8c.test
instead of prospress.test
. While this could be done earlier, I prefer to do it once the other changes have been completed.
With that, everything should be ready to go using the new domain! I’ll probably come back and update this as needed if I learn anything new as I work in my updated environment.