Xampp 7.3.3 fresh install of WordPress 404 pages unless permalink is set to plain

I have been running xampp 7.3.3 for quite a while but i have recently installed 2 fresh installs of wordpress and if the permalinks are set to anything other than plain the pages are showing 404.

i have turned off all plugins and changed themes but the issue still happens

The home page will work ok I have tried resaving permalinks I have checked the Apache modules

Has anyone had this issue?

I am going to install a new version of xampp to see if it still happens.

Any advice appreciated

How to fix category url 404’s after category permalink change

I am working on SEO for a website. So, I wanted to append "-coupon-codes" to all category URLs.

My Category Base Slug is : stores

Example what I wanted to achieve redirection :

/stores/walmart to /stores/walmart-coupon-codes 

as stores/walmart is indexed in google, I want to 301 redirect to new url

I tried this htaccess :

RewriteRule ^stores/(.*)/$   /stores/$  1-coupon-codes [R=301,NC,L] 

This was redirecting all store links to /stores-coupon-code but its 404 as original category URL doesn’t contain -coupon-codes,

and if I change any permalink to include -coupon-codes, Then, the original store URL becomes 404, and redirection isn’t working.

Rewrite rule for changing permalinks. Post name to permalink with Category

SCENARIO A

  1. I have an wordpress site that has existing posts.

  2. Permalink structure is currently configured to https://sitename.com/%postname%/

  3. I need to change the Permalink structure to https://sitename.com/%category%/%year%/%monthnum%/%day%/%postname%/ but when I save these settings https://sitename.com/%postname%/ results to 404 does not redirect to https://sitename.com/%category%/%year%/%monthnum%/%day%/%postname%/

  4. When I remove the /%category%/ and just use https://sitename.com/%year%/%monthnum%/%day%/%postname%/ the 301 redirection from https://sitename.com/%postname%/ works fine

Is there a better way to achieve changing to https://sitename.com/%category%/%year%/%monthnum%/%day%/%postname%/ with proper redirections from https://sitename.com/%postname%/?

Note: I already deactivate all plugins and just used the default twentytwenty theme. I have 11,000 existing posts.

SCENARIO B (if Scenario A does not work or there is no solution to Scenario A. Im looking at option Scenario B)

  1. The existing posts are under a category called "Local News", "local-news"
  2. Is there a way where I can just filter the rewrite rule so that if a post is under "Local News" category then the permalink structure will be https://sitename.com/%postname%/ then all other new posts will follow the main permalink structure I have set which is https://sitename.com/%category%/%year%/%monthnum%/%day%/%postname%/ ?

Currently I have this but I’m not sure it’s working properly. When I apply this it seems to work for posts that are under "Local News" category. However it breaks my PAGES. PAGES result in 404s.

function custom_permalink( $  permalink, $  post, $  leavename ) {     // Get the category for the post     $  category = get_the_category($  post->ID);     if (  !empty($  category) && $  category[0]->cat_name == "Local News" ) {         $  cat_name = strtolower($  category[0]->cat_name);         $  permalink = trailingslashit( home_url('/' . $  post->post_name .'/' ) );     }     return $  permalink; }  add_action( 'init', 'custom_rewrite_rules' ); function custom_rewrite_rules() {     add_rewrite_rule(         '([^/]+)(?:/([0-9]+))?/?$  ',         'index.php?category_name=local%news&name=$  matches[1]&page=$  matches[2]',         'top' // The rule position; either 'top' or 'bottom' (default).     ); } 

Is this a correct approach or is my code correct? I’m also not sure if the rewrite rules I made affects other things. Basically I just want to retain permalink/url of the old posts and moving forward I want to follow the new permalink settings. I’m avoiding old posts to result in 404 pages.

Thanks

Possible to remove taxonomy from permalink if uncategorized?

I’m working on a client’s website who requested that the custom search functionality I’m building out provide a number of ‘pretty’ permalinks that they can use for ad campaigns.

The post types I’m working with are community, floorplan, and ready-made homes, and they want to be able to have direct links to search results by county and community.

To achieve this, I set up taxonomies that would create nicely formatted URLS such as {county}/{community}, {county}/{community}/{floorplan} {county}/{community}/{ready-made}.

This is all working fine, however it leads to some issues. For example, If you do not specify a county in your search, you will get links like uncategorized/{community} returned in the results.

Is there any way that you can remove uncategorized taxonomy from the URL, but leave the taxonomy in if it exists?

I’ve figured out how to update the URLs in the search results, however they will lead to 404s if left completely empty because they technically don’t exist if you remove the taxonomy from the url. Ideally, I would want them to just redirect to communities/{community} for example, instead of communities/uncategorized/{community}

Changing CPT permalink

I have a CPT named rad.

I have the following code to change the permalink from "site.com/rad/post" to "site.com/category/subcategory/post".

 function remove_cpt_slug( $  post_link, $  post, $  leavename ) { // Define the CPT's name. $  post_type_name="rad"; // Get the inmediate category. $  categoryc=get_the_category( $  post->id ); // Get the parent category. if(!empty($  categoryc))      $  categoryp=get_term( $  categoryc[0]->parent, 'category' );  if ( $  post_type_name != $  post->post_type || 'publish' != $  post->post_status ) { return $  post_link; }  if(!empty($  categoryp->errors)) { $  post_link = str_replace( $  post_type_name , $  categoryc[0]->name, $  post_link ); }  if(empty($  categoryp->errors) && !empty($  categoryp->name)) { $  post_link = str_replace( $  post_type_name , $  categoryp->name."/".$  categoryc[0]->name, $  post_link ); }     return $  post_link;  }  add_filter( 'post_type_link', 'remove_cpt_slug', 10, 3 ); 

When I create a new post, it works great. However, when I visit the new permalink it has a 404 error.

Any idea of how could I fix it?

Custom structure permalink preventing 404

I am trying to find out what impact setting a custom stucture prefix in permalinks has on 404’s

I have a custom structure of:

/news-opinion/%postname%/

This is working as expected if you tried to go to a page: domain.com/news-opinion/non-existing-url I will get a 404 as expected.

However if I use: domain.com/non-existing-url this will redirect a user back to the homepage and not 404.

Am I missing somthing here I should have accounted for?

This is a Bedrock / Composer based install and this is the list of plugins in use if any of these are known to cause this issue:

"wpackagist-plugin/cache-enabler": "^1.3.4", "wpackagist-plugin/classic-editor": "1.5", "wpackagist-plugin/relevanssi": "4.2.0", "wpackagist-plugin/safe-svg": "1.9.4", "wpackagist-plugin/wp-mail-smtp": "^1.8", "wpackagist-plugin/instant-images": "4.2.0", "wpackagist-plugin/shortpixel-image-optimiser": "4.16.1", "deliciousbrains-plugin/wp-migrate-db-pro": "^1.9", "humanmade/s3-uploads": "^2.1", "custom-repo/advanced-custom-fields-pro": "^5.7.0", "custom-repo/gravityforms": "^2.4.0", "wpackagist-plugin/duplicate-post": "3.2.4", "wpackagist-plugin/filebird": "2.7.1", "wpackagist-plugin/crop-thumbnails": "1.2.6", "wpackagist-plugin/redirection": "4.7.1", "wpackagist-plugin/advanced-cron-manager": "2.3.10", "wpackagist-plugin/wp-seopress": "3.8.4", "wpackagist-plugin/cookie-bar": "1.8.7", "custom-repo/vcaching": "^1.8.0",  "wpackagist-plugin/wordpress-importer": "0.7", "wpackagist-plugin/export-media-with-selected-content": "2.0", "wpackagist-plugin/user-roles-and-capabilities":"^1.2.3", "wpackagist-plugin/wp-all-export": "1.2.5" 

If I can provide any more information that may be pertanent to this please let me know.

Any help with this would be apperciated.

Cannon see subcategory in permalink

There are a lot of articles (old one, though because I use new WordPress 5.3.1) about how to include category and subcategory in WordPress URLs. I followed those articles (pretty much are the same), but something is wrong.

I checked Settings > Permalinks > Custom Structure and added /%category%/%postname%/, and all I can see is parent category, not child category.

It’s the same issue whatever template I use, so I guess template is not a problem.

What is wrong?