October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Exclude a Folder From WordPress Permalinks

“Exclude a folder” can mean changing a custom post type URL, renaming a taxonomy base, or bypassing WordPress for a real directory. This guide shows the correct fix for each case, how to refresh rewrite rules, and how to avoid collisions and broken links.
Length10 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

“Exclude a folder” can mean three different WordPress routing jobs: removing a front prefix from one custom post type, changing a category or tag base, or keeping a real directory out of WordPress entirely. The correct fix depends on which layer owns the URL. Use post-type rewrite settings for a custom post type, the Permalinks screen for renaming taxonomy bases, and Apache or Nginx rules for a physical directory or separate application.

First identify what “exclude a folder” means

WordPress does not have one universal “exclude folder” switch. A URL is produced by several cooperating systems: the structure selected under Settings > Permalinks, rewrite arguments on registered post types and taxonomies, the rewrite rules WordPress stores, and the web server’s own request-routing rules.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Before changing anything, classify the path you want to change:

  • A custom post type has an unwanted prefix. For example, a book post type is appearing under /blog/library/title/ because the site’s global front base is /blog/. This is a post-type registration issue.
  • A category or tag has a base you want to rename or remove. A category might use /category/news/, while you would prefer /topics/news/. Renaming is supported in core; removing the base completely is not supported by the standard fields.
  • A real directory or another application must remain outside WordPress. A path such as /downloads/ may contain files, or a separate application may listen there. That path must be routed by the web server before WordPress’s catch-all rule.

These cases look similar in a browser, but changing the wrong layer can create 404 errors, collisions with pages, or rules that are overwritten the next time permalinks are regenerated.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.

Remove the global front base from one custom post type

For a custom post type, define an explicit rewrite slug and set with_front to false. The with_front value controls whether the site-wide front base is prepended to this post type’s URLs. Setting it to false keeps the type outside a global prefix such as /blog/ while still giving it its own stable segment.

Use an explicit rewrite definition

register_post_type('book', [
    'public' => true,
    'has_archive' => true,
    'rewrite' => [
        'slug' => 'library',
        'with_front' => false,
    ],
]);

With this registration, a single item uses the library slug rather than inheriting the global front base. The archive is also enabled because has_archive is set to true. Choose a slug that does not duplicate an existing page, taxonomy base, or another post type.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Deploy the change safely

  1. Find the code that calls register_post_type(). Make the rewrite change in the plugin or theme that owns the post type, rather than adding a second registration elsewhere.
  2. Deploy the code to a staging site first. Check a single item URL, the post-type archive, feeds if the type uses them, and ordinary pages and posts.
  3. In the WordPress dashboard, open Settings > Permalinks and click Save Changes once. You do not need to alter the selected structure; saving rebuilds the stored rewrite rules.
  4. Test the old and new addresses. If the public URL changed, add a permanent redirect from each important old address to its matching new address.

Do not flush rewrite rules on every page request. For a plugin, follow the normal activation and deactivation pattern: flush after the plugin is activated or deactivated, not during ordinary traffic. Repeated flushing adds unnecessary work and can mask an incorrectly registered post type.

Why the prefix may still appear

  • The code may still be registering the post type with a string rewrite value that does not set with_front to false.
  • The registration may not be running on the request that builds the rules. Confirm that the owning plugin is active and that the post type is registered before rewrite rules are flushed.
  • The new rules may not have been generated yet. Save the Permalinks screen after the code is active.
  • A page, taxonomy, or another post type may already use the chosen slug. Resolve the collision rather than adding increasingly broad rewrite exceptions.

Rename a category or tag base

Category and tag archives are taxonomies, not custom post types. WordPress’s core screen lets you change their visible bases without writing PHP.

Change the base in the dashboard

  1. Open Settings > Permalinks.
  2. Scroll to the Optional section.
  3. Enter the desired value in Category base or Tag base. For example, changing the category value to topics produces URLs such as /topics/news/.
  4. Click Save Changes to regenerate the rewrite rules.
  5. Open several archive pages, a paginated archive, a feed if your site publishes one, and a normal page whose slug resembles the new base.

The documented default values are category and tag. Core allows those values to be changed, but the standard fields cannot remove the bases from URLs altogether. Leaving the field empty is not the same as creating base-less taxonomy URLs.

Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

If you need base-less taxonomy URLs

A requirement such as /news/ instead of /category/news/ needs custom rewrite code or a maintained plugin. That approach must decide whether an incoming path is a taxonomy term, a page, a post, a feed, or a paginated request. The shorter URL space increases the chance of collisions, so test every affected content type before release.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep a written map of old and new addresses. When a base is removed or changed, redirect old archive URLs rather than allowing them to become soft 404s. Review canonical links, XML sitemaps, navigation, and internal links after the migration.

Keep a real folder or another application outside WordPress

A physical directory is not controlled by the Permalinks screen. WordPress normally receives unmatched requests through the web server’s catch-all rule and then attempts to resolve them. To keep /downloads/, an upload service, or a separate application independent, route that path before the request reaches WordPress.

Apache and Nginx rule ordering

Configure the server so the specific directory or application path is handled first, followed by the general WordPress rule that sends other requests to index.php. The exact directive differs between Apache and Nginx and between hosting layouts, so use the syntax required by your server and hosting provider. The important property is ordering: the exception must be evaluated before the WordPress catch-all.

  • Back up the server configuration before editing it.
  • Define the path narrowly; do not bypass WordPress for the entire document root when only one directory needs protection.
  • Verify that the directory’s filesystem permissions and index behavior are correct.
  • For a separate application, confirm its upstream address, socket, or virtual-host mapping with the application administrator.
  • Reload or restart the web server using your host’s approved procedure, then test the exception and ordinary WordPress URLs.

Test both sides of the boundary

  1. Request a known file or endpoint inside the excluded directory and confirm that the directory or application, not WordPress, returns it.
  2. Request a nonexistent file in that directory and observe the intended directory/application error response.
  3. Open a normal page, post, category archive, and custom post-type URL outside the path to ensure the WordPress catch-all still works.
  4. Test with and without a trailing slash if both forms are publicly reachable, and check HTTPS and the canonical host.

If a WordPress page with the same path still wins, the server exception is either below the catch-all rule or mapped to the wrong filesystem location. If every WordPress URL fails, restore the last known-good configuration and correct the server rule before trying another permalink change.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)

Use rewrite APIs or a plugin for advanced URL behavior

WP_Rewrite generates the rules used for pretty permalinks and exposes filters for post, taxonomy, search, author, and other rule sets. This is the appropriate layer for behavior that cannot be expressed by a post type’s rewrite argument or the core taxonomy fields.

Custom rewrite code can exclude one post type, map a special path, or create base-less taxonomy URLs, but it also becomes site-specific infrastructure. Document the rule order, the query variables it produces, and the content types that own each path. Test after WordPress, theme, and plugin updates because another component may add a rule with the same priority.

A maintained plugin can package this work. One official Custom Post Type Permalinks listing documents filters that can exclude a specific post type from rewrite support. Treat such a plugin as a code dependency: check its maintenance activity, test it on staging, and verify compatibility with the active theme and every other URL customization. A plugin reduces the amount of code you maintain; it does not remove collision or migration risk.

Refresh rewrite rules after every structural change

Changing PHP registration code does not automatically rewrite the rules already stored for the site. The safest manual refresh is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Open Settings > Permalinks.
  2. Confirm the intended structure and optional bases.
  3. Click Save Changes, even if you did not change a field.
  4. Retest the changed URL and an unrelated WordPress URL.

If the .htaccess file is writable, WordPress can write the Apache rules automatically. If it is not writable, the screen displays rules for manual installation. Copy those rules exactly into the server configuration approved for your environment; do not grant broad write permissions merely to make the automatic step succeed.

Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

WP-CLI option

On a site managed with WP-CLI, the wp rewrite structure command updates the permalink structure. For example:

wp rewrite structure '/%postname%/' --hard

Run it from the WordPress installation with the permissions and configuration used by the site administrator. The --hard option also updates .htaccess when that file is configured for WP-CLI to manage. The command is useful for scripted deployments, but it does not replace checking for slug collisions or preparing redirects.

Plan redirects and the SEO migration

Any change that alters a public URL is a migration, even when the new path looks cleaner. Keep the old-to-new mapping for every affected post, archive, feed, and paginated URL. Redirect each old address to its precise replacement rather than sending all traffic to the homepage.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Install and test redirects before changing links in navigation or templates.
  • Use permanent redirects for a lasting structure change and avoid chains such as old URL → temporary URL → final URL.
  • Update internal links, menus, canonical URLs, XML sitemaps, and any external integration that stores the old path.
  • Monitor server logs and analytics for requests to the old pattern after launch.
  • Keep the old rules long enough to catch links that are not under your control, while removing obsolete exceptions that create collisions.

Changing only a visible slug while leaving old addresses to return 404 responses discards existing bookmarks and incoming links. Conversely, redirecting an entire broad folder to one destination can hide mistakes and send users to irrelevant content.

Choose the right method

Method Best scope Layer Main strength Main risk or cost
Permalinks screen Supported global structures and category/tag base names WordPress core UI Fastest supported change with no custom code Category and tag bases can be renamed but not removed through the standard fields
register_post_type() with with_front => false One custom post type PHP registration Precise control over that post type’s slug and front-base behavior Requires a rule refresh, collision checks, and redirects when URLs change
Custom WP_Rewrite rules Advanced post, taxonomy, search, author, or special-path behavior PHP rewrite API Can express behavior unavailable in the core fields Rule-order conflicts and ongoing maintenance across updates
Permalink-management plugin Packaged custom post-type or taxonomy changes Plugin dependency Less bespoke code to maintain Maintenance, compatibility, and dependency risk
Apache or Nginx routing Physical directories and separate applications Web server Handles a path before WordPress receives it Can affect every application on the host and requires server access
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot the common failure modes

The new custom-post URL returns 404

Confirm that the post type is registered on the request, that its rewrite slug is spelled as intended, and that with_front is set to false when required. Save Settings > Permalinks again. If the URL still fails, look for a page or taxonomy using the same slug and test on staging with the conflicting item renamed.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

The old URL and new URL both work without a redirect

WordPress or the server may still have a compatibility rule, or a redirect was not installed. Decide which address is canonical, add a direct permanent redirect from the old address, and update internal references. Do not leave two public paths for the same content merely because both happen to resolve.

A category base change breaks pages

The new base may collide with a page slug or another rewrite rule. Choose a unique base, regenerate rules, and test pages, category archives, feeds, and pagination. If the requirement is a base-less taxonomy, use deliberately designed custom rules or a maintained plugin rather than repeatedly editing the optional field.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The physical directory is still handled by WordPress

Inspect server rule order and the path-to-directory or upstream mapping. The exception must precede the WordPress catch-all. After correcting it, reload the server and test a real file, a missing file, and ordinary WordPress URLs.

Permalinks work until the next deployment

The deployment may update PHP registration without flushing rules, or a plugin may flush at the wrong time. Add a controlled activation/deployment step that refreshes rules once, and keep server configuration changes versioned and backed up.

A practical decision checklist

  • Is the path a custom post type, a taxonomy archive, or a real filesystem/application directory?
  • Does the desired result require renaming a base, removing it, or bypassing WordPress entirely?
  • Which existing page, post, taxonomy, feed, or pagination path could collide with the new slug?
  • Have you changed the owning registration or server rule rather than adding a duplicate workaround?
  • Have you regenerated rules through the Permalinks screen or an appropriate WP-CLI deployment step?
  • Have you tested both the changed path and unaffected WordPress URLs?
  • Have you mapped every old public URL to a direct permanent redirect?
  • Can you roll back the PHP, plugin, and server configuration independently?

Bottom line

Use rewrite => ['slug' => 'library', 'with_front' => false] when one custom post type must avoid a global front prefix. Use Settings > Permalinks to rename category or tag bases, remembering that core does not remove those bases entirely. For a genuine directory or another application, configure Apache or Nginx to handle the path before WordPress. After any change, regenerate rewrite rules, test for collisions, and preserve old addresses with direct redirects.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.