Title: All pages return 404 except the home page
Last modified: March 26, 2025

---

# All pages return 404 except the home page

 *  Resolved [moonzaki](https://wordpress.org/support/users/moonzaki/)
 * (@moonzaki)
 * [1 year ago](https://wordpress.org/support/topic/custom-17/)
 * HTTPS can be defined via a variable different from $_SERVER[‘HTTPS’], opening
   via https may not work and 404 will be returned.
 * Solved via fix:
 *     ```wp-block-code
       function get_current_url(){	$REQUEST_URI = strtok($_SERVER['REQUEST_URI'], '?');	$isHttps = (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1))		|| (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')		|| (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443);	$real_url = (isset($_SERVER['HTTPS']) && $isHttps) ? 'https://' : 'http://';	$real_url .= $_SERVER['SERVER_NAME'] . $REQUEST_URI;	$test = isset($_SERVER['HTTPS']);	error_log($test);	return $real_url;}
       ```
   
    -  This topic was modified 1 year ago by [moonzaki](https://wordpress.org/support/users/moonzaki/).

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [kubiq](https://wordpress.org/support/users/kubiq/)
 * (@kubiq)
 * [1 year ago](https://wordpress.org/support/topic/custom-17/#post-18386048)
 * Hi,
 * sure, actually I have this in my todo list for a longer time and I already have
   a very similar and even a little bit better solution, so take a look, it’s solved
   in v6.6
 * I’ve also added a filter `rcptb_current_url` in there as some users have very
   specific requirements, eg:
   [https://wordpress.org/support/topic/plugin-will-not-work-on-all-sites/](https://wordpress.org/support/topic/plugin-will-not-work-on-all-sites/)
 *  Plugin Author [kubiq](https://wordpress.org/support/users/kubiq/)
 * (@kubiq)
 * [1 year ago](https://wordpress.org/support/topic/custom-17/#post-18386049)
 * .
    -  This reply was modified 1 year ago by [kubiq](https://wordpress.org/support/users/kubiq/).
 *  Thread Starter [moonzaki](https://wordpress.org/support/users/moonzaki/)
 * (@moonzaki)
 * [1 year ago](https://wordpress.org/support/topic/custom-17/#post-18386786)
 * Thanks for the quick response.
   I’ll test these solutions on a demo in the coming
   days and post the results in this thread.
 * By the way, have you considered adding a check for duplicate slugs between different
   post types, and, for example, displaying warnings about it?
 *  Plugin Author [kubiq](https://wordpress.org/support/users/kubiq/)
 * (@kubiq)
 * [1 year ago](https://wordpress.org/support/topic/custom-17/#post-18387020)
 * Yes, it was actually part of this plugin in the older versions, but there were
   many problems with this and even WordPress doesn’t care about this, as you can
   create Page and Post with the same name and slug without any warning… so one 
   day when WordPress will solve this problem in its core, then I will re-implement
   it again into this plugin

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘All pages return 404 except the home page’ is closed to new replies.

 * ![](https://ps.w.org/remove-cpt-base/assets/icon-256x256.png?rev=1759289)
 * [Remove CPT base](https://wordpress.org/plugins/remove-cpt-base/)
 * [Support Threads](https://wordpress.org/support/plugin/remove-cpt-base/)
 * [Active Topics](https://wordpress.org/support/plugin/remove-cpt-base/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/remove-cpt-base/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/remove-cpt-base/reviews/)

## Tags

 * [HTTP](https://wordpress.org/support/topic-tag/http/)
 * [HTTPS](https://wordpress.org/support/topic-tag/https/)

 * 4 replies
 * 2 participants
 * Last reply from: [kubiq](https://wordpress.org/support/users/kubiq/)
 * Last activity: [1 year ago](https://wordpress.org/support/topic/custom-17/#post-18387020)
 * Status: resolved