Use one public, extensionless URL—such as /about—while keeping about.html on the server. A permanent redirect sends visitors and search engines from the old /about.html address to /about; an internal rewrite then serves the file without changing the address shown in the browser. Removing a directory is a separate URL migration: redirect every old path, such as /docs/about.html, to its deliberately chosen replacement and check that the new slug does not collide with another page.
Need a server to try this on? Antihost offers Linux VPS plans with NVMe storage, full root access and a 14-day free trial.
The same two-step design works on Apache and Nginx, but the configuration location and syntax differ. Existing files and directories must be excluded from catch-all rules, and both slash variants, query strings, assets, loops and unknown paths need testing before launch.
As an Amazon Associate I earn from qualifying purchases.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteThe URL architecture you are trying to create
Suppose the document root contains about.html. The desired public address is https://example.com/about. Two different operations are required:
- External canonical redirect: a request for
/about.htmlreceives HTTP301and points to/about. The browser address changes, and crawlers learn which URL is canonical. - Internal rewrite: a request for
/aboutis mapped internally toabout.html. The server returns the file while the browser continues to display/about.
Do not make both forms return a normal 200 response. If /about.html and /about both work independently, links, analytics and search signals can split between duplicate addresses. The redirect must point in one direction only, and the internal mapping must not trigger that redirect again.
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Directory removal follows the same principle but requires an explicit path decision. If the old resource is /docs/about.html, choose whether the replacement is /about, /docs/about, or another URL. Extension removal alone would produce /docs/about; removing /docs as well requires an additional migration rule.
Decide the canonical paths before editing configuration
Configuration cannot resolve an ambiguous information architecture. Make a URL inventory first, including pages, downloadable files, images, JavaScript, CSS, API endpoints and directories. Mark which addresses are real resources and which are aliases. A catch-all rewrite that treats every path as an HTML page can break assets or application endpoints.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Choose slash policy
Pick either a trailing-slash convention or a no-slash convention for page URLs. The examples below use no slash for /about. If your site chooses /about/, make that choice consistently in redirects, internal links, canonical tags and the XML sitemap. Test both forms so that one is canonical rather than allowing both to return independent 200 responses.
Build a collision list
Before deleting a directory segment, compare every relevant name. For the proposed move from /docs/about.html to /about, verify that /docs/about.html, /about.html and /about do not represent different resources. Also check whether an existing directory named /about contains assets or an index file. A redirect that silently merges two different pages can send users to the wrong content and make recovery difficult.
Prepare a redirect table
List each renamed URL and its exact destination. Keep the table as an operational record for deployment, QA and later 404 investigations. Do not rely on a broad rule when a set of pages has changed names, moved between directories or requires different destinations. Specific redirects are safer and easier to remove than an over-broad expression.
Apache: hide .html with .htaccess or virtual-host rules
Apache’s mod_rewrite evaluates regular-expression rules. In per-directory context, Apache removes the directory prefix before matching, so a rule in the document root’s .htaccess file matches paths relative to that directory. If overrides are disabled, place equivalent directives in the virtual-host configuration instead; a .htaccess file will not work merely because it exists.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
Document-root pattern
RewriteEngine On
# Redirect the legacy extension to the canonical URL
RewriteCond %{THE_REQUEST} s/+(.+?).html(?:[?s]) [NC]
RewriteRule ^(.+).html$ /$1 [R=301,L,NE]
# Serve the real file without exposing the extension
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1.html -f
RewriteRule ^(.+?)/?$ $1.html [END]
The first condition examines the original HTTP request line. That distinction matters: an internal rewrite to about.html should not be mistaken for a visitor deliberately requesting the legacy extension. The rule then sends a permanent redirect from the extension-bearing path to the same path without .html. The NC flag makes the match case-insensitive; R=301 makes it permanent; L stops further rules for that request; and NE prevents Apache from unnecessarily escaping characters already present in the target.
The second block is an internal mapping. The two negative conditions protect existing files and directories, so requests for assets such as /styles.css or a real directory are not appended with .html. The file-existence condition checks whether the requested extensionless path has a matching document on disk. The final substitution is internal because it has no leading scheme or host and no redirect flag. Adapt the document-root expression and flags to the actual Apache version and directory layout.
Rules for a subdirectory
If the file sits in a subdirectory with its own .htaccess, remember that the matched pattern is relative to that directory. A rule written for the document root may therefore match incorrectly when copied into /docs/.htaccess. Test the rule against the path as Apache sees it in that context, and keep the substitution relative unless you intentionally need an absolute path.
Removing a directory segment on Apache
Use a separate redirect for a directory migration. For example, this rule maps the old /docs/about.html path to /about:
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsRewriteRule ^docs/(.+).html$ /$1 [R=301,L]
Place a specific directory rule before a general extension-removal rule so the broad rule cannot claim the request first. Expand the redirect table for every affected path; do not assume that one expression can infer the correct destination for pages with different new slugs.
Application front controllers
A site using an application may not have a one-file-per-page layout. WordPress’s standard Apache routing skips existing files and directories, then sends remaining requests to index.php. In that situation, preserve the application’s front-controller rules and add only the redirect and canonicalization logic that the application can safely support. Do not append .html to every unknown path when the application, an API or a plugin owns that route.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Nginx: put the rules in the server block
Nginx does not read Apache-style per-directory .htaccess files. Add the configuration to the appropriate server block, then validate and reload Nginx using your normal deployment procedure. A static site can use try_files to test the requested path and its .html counterpart.
Static-site pattern
location / {
try_files $uri $uri/ $uri.html =404;
}
# Legacy extension redirect
location ~ ^/(.+).html$ {
return 301 /$1;
}
The try_files directive checks whether each candidate file or directory exists and internally redirects when no candidate is found. Here, Nginx first tests the literal URI, then a directory, then the same path with .html; an unmatched request receives 404. The regular-expression location handles an incoming extension-bearing URL and returns a permanent redirect to the extensionless path.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Keep the redirect location separate from the file lookup. Otherwise, an internal attempt to serve about.html can be redirected back to /about, creating a loop or preventing the file from being served. Confirm the final response sequence with a header-only request and a normal browser request.
Application routing on Nginx
For an application, use its front controller rather than blindly appending .html. A common WordPress-style pattern is:
try_files $uri $uri/ /index.php?$args;
This preserves real files and directories, then passes other requests—including their query arguments—to the application. Combine it with an explicit legacy redirect only when the application’s routing and canonical URL settings agree. A static-site try_files rule and a front-controller rule are alternatives for different site architectures, not directives to stack indiscriminately.
Removing a directory is a path migration, not an extension trick
Changing /docs/about.html to /about changes two path components: the extension and the docs directory. Treat it as a migration with its own map.
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Choose the destination for each page
- Use
/docs/aboutif the directory still conveys useful organization. - Use
/aboutonly when the page belongs at the site root and no root-level slug conflict exists. - Send a page to a different slug when the old name is misleading, but record that destination explicitly.
Apache and Nginx examples
Apache:
RewriteRule ^docs/(.+).html$ /$1 [R=301,L]
Nginx:
rewrite ^/docs/(.+).html$ /$1 permanent;
These examples cover the shown pattern only. They do not prove that every filename in /docs should move to the root. Exclude assets and special endpoints, and add individual exceptions before the general migration rule when necessary.
Preventing slug collisions
Check the old directory, the root and any generated routes for duplicate names. A collision can occur even when no physical file exists: an application route, taxonomy page or reserved endpoint may already claim /about. Resolve the conflict before deploying redirects. After launch, monitor 404s and unexpected 200 responses for paths that were accidentally merged.
Preserve search signals and site functionality
Update every internal link to the chosen canonical form instead of making visitors follow redirects. Regenerate the XML sitemap with canonical URLs, and update canonical link elements in page markup. Keep the old URLs redirecting permanently so bookmarks, external links and cached search results continue to reach the replacement.
Do not redirect an old URL to the home page merely to avoid a 404. Map it to the closest equivalent resource, or return an intentional 404 or 410 when no replacement exists. Redirect chains—old extension to an intermediate directory URL and then to the final URL—add latency and make diagnosis harder. Point each legacy address directly to its final canonical destination.
Redirect substitutions that do not specify a new query string normally retain the incoming query string, but verify this behavior in your exact Apache or Nginx configuration. Tracking parameters, searches and pagination can expose edge cases. Never discard meaningful parameters accidentally, and do not create a second canonical URL solely because a query string is present.
Deployment and testing checklist
- Back up configuration and content. Save the current virtual-host or server-block file and the existing
.htaccessbefore editing. - Confirm the canonical policy. Decide extension, directory and slash behavior, then apply the same choices to links, sitemaps and canonical tags.
- Install rules in the correct location. Use
.htaccessonly when Apache overrides are enabled; use a virtual-host configuration otherwise. Put Nginx directives in the relevant server block. - Order specific rules first. Directory migrations and exceptional slugs must run before broad extensionless catch-all rules.
- Test legacy redirects. Request representative
.htmlURLs and verify one301response whoseLocationis the final clean URL. - Test canonical serving. Request the clean URL and confirm a single
200response containing the intended document. - Test both slash forms. Check
/aboutand/about/; whichever is non-canonical should redirect consistently rather than produce a second successful page. - Test query strings. Use a URL such as
/about.html?ref=menuand verify that the required query data survives the redirect. - Test encoded and unusual characters. Check spaces, percent-encoded characters and case variants that your site accepts. Confirm that the redirect does not create malformed or unsafe paths.
- Test real files and directories. Load CSS, JavaScript, images, downloadable files and directory indexes. They must not be rewritten as HTML pages.
- Test unknown paths. An unrecognised URL should reach the intended application route or return
404, not fabricate a page by appending.html. - Check for loops and chains. Follow redirects with a header tool and inspect every hop. The final response should be the intended
200page, not another redirect. - Review logs after release. Watch redirect counts, 404s, server errors and requests for old paths. Add missing one-to-one redirects rather than widening a catch-all rule blindly.
Troubleshooting common failures
The clean URL returns 404
On Apache, verify that mod_rewrite is loaded, overrides are enabled, and the .htaccess file is in the directory you think it is. Check the document-root path used by the file-existence condition and remember that per-directory patterns omit the directory prefix. On Nginx, confirm that the request is handled by the intended server block and that $uri.html points to the actual file location. If an application owns the route, replace the static lookup with its front-controller rule.
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
The browser keeps showing .html
The redirect rule may be missing, ordered after a catch-all rule, or prevented by a condition that does not match the original request. Check the response headers directly rather than relying on a browser cache. A request for the old URL must receive the external 301; an internal rewrite alone will never change the displayed address.
Every request redirects repeatedly
This usually means the internal file lookup is being fed back into the legacy redirect. On Apache, use the original-request condition so only a client request containing .html is redirected. On Nginx, keep the regex redirect location from intercepting the internal candidate or redesign the location structure so the file can be served without another external redirect.
Images, CSS or downloads break
A catch-all rule is probably rewriting existing files or directories. Retain the !-f and !-d exclusions on Apache, or the literal-file and directory candidates in Nginx’s try_files. Check the asset paths generated by the application as well as those written in templates.
Old links lose parameters
Inspect the redirect’s Location header. A substitution that explicitly adds a question mark can replace the original arguments; a substitution without a new query string generally retains them, subject to the server’s exact behavior. Adjust the rule deliberately and retest searches, tracking values and any application parameters that affect the response.
A directory move sends users to the wrong page
Review the collision list and redirect table. A broad capture such as (.+) may map a file, endpoint or already-canonical root slug into the wrong destination. Add a specific exception or remove the migration rule for resources that should stay in place.
Apache and Nginx compared
| Concern | Apache | Nginx |
|---|---|---|
| Rule location | .htaccess when overrides are enabled, otherwise virtual-host configuration |
Server-block configuration; no Apache-style .htaccess |
| Legacy redirect syntax | RewriteCond plus RewriteRule with R=301 |
return 301 or rewrite ... permanent |
| Extensionless file lookup | Rewrite only when the request is not an existing file or directory and the matching .html file exists |
try_files $uri $uri/ $uri.html =404 for a static site |
| Application integration | Preserve the application’s front-controller rules after real-file and directory exclusions | Use the framework’s front controller, such as try_files $uri $uri/ /index.php?$args for a WordPress-style setup |
| Directory migration | Match the old relative path and redirect to the chosen absolute path | Use an explicit rewrite or return in the server block |
| Main safeguards | Original-request condition, file/directory exclusions, rule ordering and collision checks | Location ordering, file/directory candidates, loop checks and collision checks |
Security and operational cautions
Redirects built from unvalidated user input can create unsafe redirects or expose unintended paths. Constrain captures to the site’s own host and expected path characters. Avoid accepting a user-supplied destination parameter, and review encoded separators, dot segments and unexpected hosts in test requests.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Use permanent redirects only after the mapping is correct. During development, a temporary response can make iteration easier, but leaving the wrong permanent redirect in browsers and intermediary caches complicates rollback. Keep configuration under version control, deploy a small representative sample first, and retain the redirect table so future URL changes remain auditable.
Quick Recap
A practical migration sequence
- Inventory current URLs and identify files, directories and application-owned routes.
- Select the canonical extensionless and directory-free forms, including slash policy.
- Check collisions and assign a final destination to every renamed page.
- Update templates, navigation, canonical tags and the XML sitemap to use final URLs.
- Add explicit legacy redirects, then add the internal extensionless mapping with real-file and directory exclusions.
- Deploy on the correct Apache or Nginx configuration layer and validate syntax before reload.
- Run redirect, asset, query-string, encoded-character, unknown-path and loop tests.
- Monitor logs and 404 reports, adding narrowly scoped redirects for legitimate misses.
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.




