Skip Navigation

[Resolved] custom post types path rewriting suddenly fails

This thread is resolved. Here is a description of the problem and solution.

Problem:

Accessing page via domain.com/columns/ was giving 404 error while domain.com/?columnnists=postslug proved to work just fine.
Solution:

Upon further inspection I found the following rules in the .htaccess file:

RewriteRule ^/?taxonomy - [L,R=404]
RewriteRule ^/?category - [L,R=404]
RewriteRule ^/?columnists - [L,R=404]
RewriteRule ^/?rss.xml - [L,R=404]
RewriteRule ^/?ads.txt - [L,R=404]
RewriteRule ^/?podcasts/shows/ - [L,R=404]

Editing the .htaccess file fixed the error.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Sao_Paulo (GMT-03:00)

This topic contains 7 replies, has 2 voices.

Last updated by Mateus Getulio 1 year, 4 months ago.

Assisted by: Mateus Getulio.

Author
Posts
#2675595

I am trying to: not doing anytyhing new, have always been using the default rewrite setting of custom posts so for instance "columns" post type will be rabble.ca/columns/postslug/

Suddenly, it stopped working, Every link to every custom post of this type began to 404.

I had to disable rewriting setting in custom field settings so now all the columns are showing at url rabble.ca/?columnnists=postslug

Link to a page where the issue can be seen:

hidden link

I expected to see:

hidden link

Instead, I got:

404 until i disabled your 'rewrite' feature.

I tried changing and reverting the permalinks settings in wordpress UI to rebuild that, no avail

#2675601

Mateus Getulio
Supporter

Languages: English (English )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello there,

What if you try to temporarily disable any plugin that interferes with your permalink and redirect rules. Eg.: the Redirect plugin. Does it still show the error?

In addition to that, I'd also like your help enabling the WordPress debug mode.

To do so, please add the following code in wp-config.php file of your site:

// Enable WP_DEBUG mode
define( 'WP_DEBUG', true );
  
// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );
  
// Disable display of errors and warnings 
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
  
// Use dev versions of core JS and CSS files (only needed if you are modifying these core files)
define( 'SCRIPT_DEBUG', true );

Please check following links to read more about debugging with WordPress.

https://codex.wordpress.org/Debugging_in_WordPress
https://codex.wordpress.org/Debugging_in_WordPress#Example_wp-config.php_for_Debugging

After doing that please reproduce the 404 error again, then check if you can find a file debug.log inside the wp-content folder. Open it and send us the last lines of log here in this ticket.

Thanks, please let us know.

#2675605

Mateus Getulio
Supporter

Languages: English (English )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello,

I would like to request temporary access (wp-admin and FTP) to your site to take better look at the issue. You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

Our Debugging Procedures

I will be checking various settings in the backend to see if the issue can be resolved. Although I won't be making changes that affect the live site, it is still good practice to backup the site before providing us access. In the event that we do need to debug the site further, I will duplicate the site and work in a separate, local development environment to avoid affecting the live site.

Privacy and Security Policy

We have strict policies regarding privacy and access to your information. Please see:
https://toolset.com/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

**IMPORTANT**

- Please make a backup of site files and database before providing us access.
- If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this: hidden link

Please, let me know if you need any additional details. Have a nice day.

#2675615

Mateus Getulio
Supporter

Languages: English (English )

Timezone: America/Sao_Paulo (GMT-03:00)

Thank you for sharing the info.

I wanted to check if you authorize me to make a temporary copy of your site locally so I can debug it without affecting the live site.

I'll make sure to delete it the moment we identify and fix the issue.

Thank you, please let us know,

#2675617

yes go ahead, warning the site is large

#2675771

Mateus Getulio
Supporter

Languages: English (English )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello there,

Indeed, I tried copying the site but I wasn't able to. Migrating and/or creating a package failed multiple times due to the site's size.

I've performed some debugging on the live without affecting it.

One thing that I noticed is that if we hit a page that doesn't exist, we're redirected to the site's custom 404 not found page.

However, for the 'columnist' or 'column' endpoints we're shown a server's default 404 page and it seems like there's no processing involved, the moment we call it, it gets sent straight away to the default 404 not found page.

I found the following rules on the .htaccess file:

RewriteRule ^/?taxonomy - [L,R=404]
RewriteRule ^/?category - [L,R=404]
RewriteRule ^/?columnists - [L,R=404]
RewriteRule ^/?rss.xml - [L,R=404]
RewriteRule ^/?ads.txt - [L,R=404]
RewriteRule ^/?podcasts/shows/ - [L,R=404]

The other URLs in there have the same behavior, I believe this could be the source of the issue but I didn't want to edit it because the FTP access is not working for me and I was afraid I might get locked out from the wp-admin if something goes wrong.

Can you please review the .htaccess file and temporarily remove/comment out those rules and any others 404-related? Then please make sure to purge the cache and test it again to see if there's any difference.

In addition to that, please review if the FTP data you shared is correct, if you need an IP to add to the allowlist, I shared that above, privately.

Thank you, please let us know.

#2676075

Thank you it looks like the htaccess rules might have been the problem

#2676318

Mateus Getulio
Supporter

Languages: English (English )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello there,

Thank you for following up on this issue.

I hope we are good to close here.

Feel free to contact us any time if you need assistance with our products.

Kind regards