Service Plugin 404 errors when switching Site URL

ForumCategory: TechnicalService Plugin 404 errors when switching Site URL
uufsd asked 3 months ago

The issue  we’re having is that when we recently changed Site URL in the WP Settings from http://uufsd.org/wp2 to http://uufsd.org, clicking a service results in a 404. If we switch the Site URL back, then the service links work again. The Service Plugin itself seems to still display services as does pages that show a list of services. The thing that doesn’t work is clicking on the service itself to see the details of the service. Using version 1.1.2 of the UUA Theme.

Kevin replied 3 months ago

I just went to your site and it looks like the services are linking to the correct URL (without /wp2 path). Also, the 404 error page looks like the one provided by your web hosting, not the theme. This may not be a WordPress issue but in fact a server issue. 1) Make sure your .htaccess file is configured properly. 2) Try to flush rewrite rules in my second answer below.

4 Answers
Margy Levine Young Staff answered 3 months ago

When you change the URL of a WordPress website, lots of links change. See this article (or search for “WordPress change URL” or “WordPress move from subdirectory”) for details of what you need to do.

Kevin answered 3 months ago

If you’re comfortable running SQL Statements directly in your database, you could try running the following SQL Statements to find/replace all instances of your old URL:
 
https://gist.github.com/kevinvess/7686488
 
Important: before trying, please back up your database and files.

Margy Levine Young Staff replied 3 months ago

Interestingly, Dave Masser has the same issue and says, “If it was just the old services created before the switch that were having problems, using this update tool would make sense. But services created after the switch also 404. And it is only services, nothing else on the site has this behavior, which makes me think this isn’t a general WP issue, but something specific to how services work. Do you think re-installing the service plugin could help?”

Kevin replied 3 months ago

Interesting– now I’m wondering if this is related to the `rewrite` argument passed to the register_post_type() function of the plugin (where it rewrites the plugin slug/URL for the services post-type). Specifically, the `with_front => false` argument.

Kevin answered 3 months ago

The other thing you could try– is to flush rewrite rules or permalinks (usually needs to be done manually for new custom post types) from the Dashboard:
 

  1. In the main menu find “Settings › Permalinks”
  2. Scroll down if needed and click “Save Changes”
  3. Rewrite rules and permalinks are flushed.
Kevin answered 2 months ago

The issue you’re experiencing is related to how your server is configured. It seems, you’re already using the /services path for something else and thus the web server returns a 404 error because the WordPress service URL does not exist within your current /services directory.
 
If you go to the following URL, you’ll see the web server directs you to some other website: http://uufsd.org/services
 
If you need support resolving this issue, email Vess Studio at: hello@vess.studio and we’d be happy to work with you to fix this.

uufsd replied 2 months ago

Your answer solved the problem. Thanks!