Skip to content

URL Rewriting Tool


Enter a URL



Eg. http://www.example.com/test.php?firstid=1&secondid=10

About URL Rewriting Tool

100% Free No Sign-Up Dynamic → Static URL Generates .htaccess Code Apache mod_rewrite Ready

Every link you share, every SERP result, every anchor text on a backlink — they all show your URL. A URL like example.com/products.php?cat=12&id=487&sort=asc&page=3 communicates nothing useful to a human reader, buries your keyword completely, and gives search engine crawlers an ambiguous string of parameters to interpret rather than a clean, crawlable path. That URL is not just ugly. It is actively losing you traffic.

The DigitalSub Pro URL Rewriting Tool solves this in two steps. First, it converts any dynamic URL into a clean, keyword-rich, human-readable equivalent. Second — and this is the part that separates it from a simple text formatter — it generates the Apache mod_rewrite code you need to make the rewrite actually work on your server. You get both the clean URL and the .htaccess rules to implement it, ready to copy and paste.

This page explains what URL rewriting is at a technical level, why URL structure is an underappreciated SEO lever that most site owners never optimise, the exact anatomy of a perfect SEO-friendly URL, and when and how to use the rewrite rules this tool generates. By the end, you will understand both the "why" and the "how" — not just how to use the tool, but why fixing your URLs can meaningfully improve your rankings and click-through rates.

45%
More clicks for URLs containing the target keyword vs those without (Backlinko)
<75
Characters — Google's recommended maximum URL length for search results
Hyphens (not underscores) — the only separator Google reads as a word space
2s
Time to generate a clean URL + ready-to-paste .htaccess code

What the Tool Does — Before and After

Enter a dynamic URL and the tool returns a clean version plus the mod_rewrite code. Here is a real transformation example so you know exactly what to expect.

✗ Input — Dynamic URL (what your server currently shows)
https://example.com/products.php?category=running-shoes&id=487&color=red&sort=price
✓ Output — Clean SEO-Friendly URL (what the tool generates)
https://example.com/running-shoes/red-product-487
Generated .htaccess Code — Copy and paste into your server's .htaccess file
# URL Rewriting Rules — Generated by DigitalSub Pro
# Place this in your website's root .htaccess file

Options +FollowSymLinks
RewriteEngine On

# Rewrite clean URL back to dynamic URL internally
RewriteRule ^running-shoes/([^/]+)/?$ products.php?category=running-shoes&id=$1 [L,QSA]

# Redirect old dynamic URL to new clean URL (preserves SEO)
RewriteCond %{QUERY_STRING} ^category=running-shoes&id=([0-9]+)
RewriteRule ^products\.php$ /running-shoes/%1? [R=301,L]
          

The tool generates both the clean URL format and the server-side rules to implement it. The [R=301,L] flag ensures Google knows the clean URL is the permanent, authoritative address — preserving all existing ranking signals.

What Is URL Rewriting — And How Is It Different From a Redirect?

URL rewriting is one of the most commonly misunderstood concepts in web development and SEO. People frequently confuse it with redirecting, use the terms interchangeably, and end up implementing the wrong solution. The distinction matters — both for how your site works technically and for what Google sees.

URL Rewriting (Internal)

True URL rewriting happens invisibly at the server level. The visitor requests example.com/running-shoes/product-487 — a clean, human-readable URL. The server's mod_rewrite module intercepts this request and internally maps it to products.php?id=487&category=running-shoes — which is what the PHP script actually needs to run. The visitor's browser never sees the dynamic URL. The browser's address bar still shows the clean URL. The server processes the dynamic URL behind the scenes. One URL exists publicly; the other exists only internally.

URL Redirecting (External)

A redirect tells the browser (and search engines): "this URL has moved — please go to a different address." There are two types that matter for SEO. A 301 redirect is a permanent redirect — it passes link equity from the old URL to the new one and tells Google to update its index. A 302 redirect is a temporary redirect — it does not pass full link equity and tells Google the original URL should stay in the index. When cleaning up old dynamic URLs that are already indexed and may have backlinks, you use a 301 redirect to point them to the new clean URL.

URL Rewriting vs URL Redirecting — The Key Difference URL Rewriting (Internal) Browser requests: /running-shoes/487 Server (mod_rewrite) products.php?id=487 Browser address bar shows: example.com/running-shoes/487 Clean URL always visible — dynamic URL hidden URL Redirecting (External) Browser requests: products.php?id=487 301 Permanent Go to new URL! Browser address bar changes to: example.com/running-shoes/487 Browser sent to new URL — use for old indexed pages
Fig 1 — URL rewriting hides the dynamic URL from the browser (the clean URL always shows). Redirecting sends the browser to a different URL — use this for pages already indexed under the old dynamic URL to preserve their ranking signals

In practice, the best approach for a site transitioning from dynamic to clean URLs involves both techniques: rewriting so all new requests use the clean URL, and 301 redirecting so any old dynamic URLs that were indexed or linked to automatically point to the clean version. The tool generates both types of code in one output.

Why URL Structure Is an Underused SEO Lever — With Real Data

URL structure sits in an awkward middle ground in most SEO discussions: everyone knows it matters, most guides mention it briefly, and almost nobody optimises it systematically. This is a significant missed opportunity, because clean URL structure delivers benefits across three distinct dimensions simultaneously.

1. Rankings — URLs Are a Direct Ranking Signal

Google has confirmed that URLs are a ranking signal — specifically, that keywords in a URL are a relevance indicator. When a search result's URL contains the queried keyword, Google's ranking systems treat it as a topical relevance signal. This does not mean keyword-stuffing your URL will catapult you to position one — but in competitive queries where other ranking signals are equal, a keyword-containing URL regularly outperforms one without. Backlinko's analysis of 4 million Google search results found that URLs with the target keyword generate 45% more clicks than those without — a massive CTR difference for a purely structural change.

2. Click-Through Rate — URLs Appear in Search Results

Your URL appears in the Google search result, shown in green text beneath the title. Users read it. A URL that says example.com/best-running-shoes-flat-feet tells the user instantly that this page is exactly what they searched for. A URL that says example.com/p.php?id=487&cat=12&sort=0 says nothing — or worse, raises suspicion. In a result where two pages have equally strong titles and descriptions, the readable URL wins the click. Every time.

3. Crawlability — Dynamic URLs Create Indexing Problems

Search engine crawlers have a finite budget for crawling any website — they will not crawl every URL infinitely. Dynamic URLs with query strings create a particular problem: parameter combinations generate duplicate content. ?sort=price, ?sort=rating, ?sort=name all produce the same page with different sort orders — but Google may crawl all three, waste crawl budget on duplicates, and dilute the ranking signals for the canonical version. Google Search Console even has a URL Parameters tool specifically to manage this problem. Clean URLs sidestep it entirely.

Why URL Structure Affects SEO in Three Different Ways Rankings Keywords in URL = relevance signal to Google's algorithm /running-shoes/flat-feet Keyword visible = +relevance signal Click-Through Rate URL appears in search results Users read it before clicking example.com › shoes › flat-feet Readable = users trust & click Crawlability No duplicate parameter combinations wasting crawl budget One URL = One Page No ?sort=price + ?sort=name duplicates
Fig 2 — Clean URLs improve SEO through three independent channels simultaneously: direct ranking signals, user click-through rate, and crawl efficiency. Most sites only need to fix URLs once to benefit from all three permanently

The Anatomy of a Perfect SEO-Friendly URL

Understanding what makes a URL "good" is not about memorising a checklist — it is about understanding what each part of the URL communicates to both users and search engines. Here is a fully annotated breakdown of a well-structured URL.

A Well-Structured URL — Annotated

https://digitalsub.pro/seo-tools/keyword-density-checker
Protocol
https://

Always HTTPS. Google confirmed HTTPS as a ranking signal in 2014. Any site still on HTTP in 2025 is losing a ranking signal and triggering browser security warnings.

Domain
digitalsub.pro

Short, memorable, brandable. Does not need to contain the keyword — domain-level keywords are no longer a meaningful ranking signal. Brand recognition matters more.

Subfolder / Category
/seo-tools/

Communicates site hierarchy. Groups related content together — a topical signal. Keep nesting shallow: 3–4 levels maximum. Deep nesting dilutes URL authority.

Slug (Page Name)
keyword-density-checker

The most SEO-critical part. Contains the primary keyword, uses hyphens (not underscores), is lowercase, under 60 characters, and clearly describes the page content.

Notice what this URL does not contain: no file extension (.php, .html), no query parameters (?id=), no dates that make content feel stale, no stop words ("the," "and," "of"), no uppercase letters, no underscores or spaces. Every character in the URL either contributes to describing the page or adds structural hierarchy. Nothing else.

Dynamic URLs vs Clean URLs — Real Transformation Examples

The difference is immediately visible. Here are five real-world URL transformations across common website types, showing exactly what the URL Rewriting Tool helps you achieve.

Dynamic URL
example.com/index.php?page=about&lang=en&v=2

No keywords, 3 parameters, .php extension visible, no hierarchy

Clean URL
example.com/about

One word, clear purpose, extension-free, universally readable

eCommerce Dynamic
shop.com/store/products.aspx?cat=12&sub=45&pid=8901&size=M&color=red

5 parameters, .aspx visible, zero keyword value, looks spammy

eCommerce Clean
shop.com/womens/t-shirts/red-graphic-tee

Category hierarchy, keywords present, hyphens used, no parameters

Blog Dynamic
blog.com/articles.php?id=2847&author=john&date=20230614

ID number meaningless, date makes content feel outdated, no topic

Blog Clean
blog.com/seo/how-to-improve-core-web-vitals

Category + keyword-rich slug, evergreen (no date), clearly describes the post

News Site Dynamic
news.com/cgi-bin/story.cgi?sec=tech&id=TK20240312&utm_src=home

cgi-bin path, session tracking in URL, no readable story title

News Site Clean
news.com/technology/google-algorithm-update-2025

Section + keyword slug, instantly readable, bookmarkable and shareable

How mod_rewrite Works — Understanding the .htaccess Code the Tool Generates

The code generated by this tool uses Apache's mod_rewrite module — the engine that makes URL rewriting possible on the most widely used web server in the world. Over 47% of active websites run on Apache. If you use shared hosting through cPanel, Bluehost, SiteGround, A2 Hosting, or virtually any standard web host, mod_rewrite is available to you.

The code is placed in a file called .htaccess (the dot prefix makes it a hidden file on Unix systems) in your website's root directory. Apache reads this file for every request and applies any rules it contains before serving content. You do not need server-level access — just the ability to create or edit the .htaccess file in your hosting file manager or via FTP.

Here is a plain-English breakdown of every directive in the generated code, so you know exactly what you are pasting into your server.

Reading the Generated .htaccess Code — Line by Line

RewriteEngine On
Activates the rewrite engine

This must be the first mod_rewrite directive in any .htaccess file. Without it, all subsequent RewriteRule and RewriteCond directives are ignored entirely. Write it once per .htaccess file. If you already have a working .htaccess with RewriteEngine On, do not add it again — just append the new rules below your existing ones.

RewriteCond
A condition that must be true for the next rule to apply

RewriteCond sets a conditional filter on the following RewriteRule. For example, RewriteCond %{QUERY_STRING} ^id=([0-9]+) means "only apply the next rule if the query string starts with id= followed by numbers." Conditions can test the URL, the domain, the browser, the request method, or dozens of server variables. Multiple conditions can be chained — all must be true for the rule to apply.

RewriteRule
The actual transformation — pattern to match and what to replace it with

The core of mod_rewrite. Format: RewriteRule [pattern] [substitution] [flags]. The pattern is a regular expression that matches against the incoming URL. The substitution is what the matched URL becomes. For example, RewriteRule ^about/?$ /about-us [R=301,L] matches requests for /about or /about/ and permanently redirects them to /about-us.

[R=301,L]
Flags — instructions that control how the rule is processed

Flags modify rule behaviour. The most important ones: [L] means "Last" — stop processing further rules after this one matches (always use this to prevent rules from interfering with each other). [R=301] means "external redirect with HTTP 301" — the browser changes its address bar and Google treats the old URL as permanently moved. [R=302] is a temporary redirect — use only for genuinely temporary changes. [QSA] (Query String Append) adds any existing query parameters to the rewritten URL. Omit [R] for internal rewrites where you want the browser to show the clean URL but not be redirected.

How to Use the URL Rewriting Tool — Step by Step

1

Enter Your Dynamic URL

Paste your current ugly dynamic URL into the input field — the one with ?id=, &cat=, .php? or other parameter strings.

2

Click Rewrite

The tool analyses the URL structure, extracts meaningful elements, and generates clean URL options along with the corresponding .htaccess mod_rewrite code.

3

Choose Your Clean URL

Review the generated options — you may get variations using slashes or hyphens. Pick the one that best describes the page and fits your site's URL structure.

4

Copy the .htaccess Code

Copy the generated RewriteRule directives. Add them to your website's .htaccess file in the root directory via your hosting file manager or FTP client.

✓ Before Pasting the Code — Quick Server Checklist

Confirm you are on an Apache server

mod_rewrite is an Apache module — it works on most shared hosting plans. It does not work on Nginx or IIS. If you are on Nginx, you need nginx.conf rewrite rules instead. If unsure, check with your hosting provider — cPanel usually means Apache.

Back up your existing .htaccess file first

A syntax error in .htaccess causes a 500 Internal Server Error that takes your entire site offline. Before adding anything, download a copy of your current .htaccess so you can restore it instantly if something goes wrong.

Check for existing RewriteEngine On

If your .htaccess already contains RewriteEngine On (common in WordPress), do not add it again. Simply append the new RewriteRule directives below your existing rules.

Test with a single rule before adding many

Add one rewrite rule, save the file, and test it in your browser. Confirm the clean URL works and the old dynamic URL redirects correctly. Only then add additional rules. This makes debugging much easier if something goes wrong.

Who Benefits Most From URL Rewriting

eCommerce Site Owners

Shopping cart systems like Magento 1, osCommerce, and older WooCommerce configurations generate parameter-heavy URLs for every product variation. Each colour, size, and sort order gets its own URL — creating thousands of duplicate-content pages eating crawl budget. URL rewriting consolidates this into one clean URL per product.

PHP/Custom-Built Sites

Sites built with raw PHP, Perl, or older scripting frameworks — rather than a modern CMS that handles pretty URLs automatically — almost always have dynamic URL problems. These sites show the actual file name (product.php) and query string in every URL. URL rewriting fixes this without changing a single line of application code.

SEO Professionals Doing Site Audits

When auditing a client's site, dynamic URLs are one of the first technical issues to identify and address. Being able to generate the exact .htaccess code to fix each problematic URL — not just identify the problem — accelerates delivery and proves technical competency to clients who can see the working fix immediately.

Content Management System Migrations

Moving from an old CMS to a new one — or from a flat-file system to WordPress — often changes every URL on the site. During migration, a comprehensive set of rewrite rules ensures that every old URL permanently redirects to its new equivalent, preserving all accumulated link equity and preventing a catastrophic ranking drop on launch day.

Web Developers Building Cleaner Sites

Developers who build the backend logic first — where every page is served by a PHP script with query parameters — use mod_rewrite rules at deployment to give the finished site clean URLs. The application code never needs to change; only the URL the user sees is transformed at the server layer.

Sites Removing File Extensions for Security

Exposing your server-side technology (.php, .asp, .aspx, .cfm) in URLs tells potential attackers exactly what framework to target. URL rewriting can strip these extensions from all visible URLs while the server still uses the files internally — making your stack less fingerprint-able to automated vulnerability scanners.

URL Rewriting Mistakes That Cost You Rankings

Getting URL structure wrong can damage SEO significantly. Here are the most common errors — and how to avoid each one.

Changing URLs Without 301 Redirects

The most expensive mistake. If you clean up dynamic URLs but fail to redirect the old ones, every existing backlink, indexed page, and shared link breaks instantly — all that link equity disappears and your rankings collapse. Always implement 301 redirects for any URL that already exists publicly.

Fix: Always 301 redirect old dynamic URLs to new clean ones.

Using Underscores Instead of Hyphens

Google reads hyphens as word separators but historically did not always read underscores the same way. /running_shoes may be read as one word "runningshoes" while /running-shoes is clearly two words. Always use hyphens in URL slugs.

Fix: Replace all underscores with hyphens in URL slugs.

Including Dates in URLs

URLs with dates like /2019/05/14/how-to-write-seo-content make content appear outdated even after updates. Users in search results see the date and assume the information is stale — lowering CTR. Evergreen URLs perform better over time.

Fix: Use /category/page-title format without dates.

Keyword-Stuffing the URL

A URL like /best-seo-tools-free-seo-tools-seo-tools-online looks spammy to both users and Google. Short, descriptive, one-keyword slugs consistently outperform stuffed ones. The keyword needs to appear once — naturally.

Fix: One primary keyword in the slug, under 60 characters total.

Creating Both www and non-www Versions

If www.example.com/page and example.com/page both serve content without redirecting to one canonical version, search engines see duplicate content and split link equity between them. Choose one and redirect the other via .htaccess.

Fix: 301 redirect one version to the other consistently.

Mixed Case URLs

Most web servers treat /Running-Shoes and /running-shoes as different pages — creating duplicate content. Browsers and crawlers hit both. Always use lowercase exclusively and add a rewrite rule to force lowercase if your CMS does not do this automatically.

Fix: Always lowercase URLs. Rewrite any capital-letter versions to lowercase.

A Note on WordPress and Modern CMSs — When You May Not Need This

If your site runs on WordPress, you likely do not need to manually write mod_rewrite rules for clean permalink structure — WordPress handles this for you through its built-in Permalink settings. Under Settings → Permalinks, selecting "Post name" (/sample-post/) configures WordPress to use clean URLs and automatically updates the .htaccess file with the correct rewrite rules.

Similarly, Drupal, Joomla (with the SEF URL feature), and most modern frameworks like Laravel and Django handle clean URL routing natively through their own routing systems, which do not require manual .htaccess intervention.

The URL Rewriting Tool is most valuable for: custom-built PHP sites without a modern framework, older CMS installations that predate clean URL support, legacy eCommerce systems, site migrations where old URLs need to be redirected to new ones, and any situation where you want to manually control exactly which URL maps to what at the server level.

Getting Maximum Value From Your URL Rewriting

5 Pro-Level URL Rewriting Strategies

  1. Audit your site's existing URLs before rewriting anything. Use a crawler like Screaming Frog (free up to 500 URLs) to export every URL on your site. Identify which are dynamic, which are already clean, and which have backlinks pointing to them. The ones with backlinks are your highest priority — those 301 redirects must be set up correctly or you lose the link equity built up over years.
  2. Set a low TTL on rewrite rules during testing. If you control your server's caching configuration, setting a low cache time while testing new rewrite rules prevents stale cached responses from masking whether your rules are working. Once confirmed working, cache as aggressively as your content freshness requirements allow.
  3. Submit your sitemap after cleaning up URLs. After implementing clean URLs site-wide, update your XML sitemap to reflect the new URL structure and submit it in Google Search Console. This accelerates re-crawling and speeds up the time before Google starts serving the clean URLs in search results. Use our XML Sitemap Generator to create an updated sitemap quickly.
  4. Check your internal links after rewriting. URL rewriting and 301 redirects handle external links — but internal links throughout your site still point to the old dynamic URLs. While the 301 will handle these functionally, each redirect adds a small latency cost and a potential link equity dilution. Update internal links to point directly to clean URLs wherever possible.
  5. Use canonical tags as a safety net alongside redirects. Even with 301 redirects in place, canonical tags on your clean URL pages tell Google explicitly: "this is the authoritative version." For sites with complex parameter handling — especially eCommerce sites with filter URLs — canonical tags provide a belt-and-suspenders approach that prevents any parameter combination from being indexed as a separate page.

Tools That Work Alongside URL Rewriting

URL rewriting fits into a broader technical SEO and content workflow. These free DigitalSub Pro tools handle the adjacent tasks.

Frequently Asked Questions

Real questions from webmasters, developers, and SEOs who work with URL structure and .htaccess configuration.

Do clean URLs actually improve Google rankings, or is this a myth?

They do help — but the mechanism is more nuanced than "clean URL = higher ranking." Google has confirmed that keywords in URLs are a relevance signal, and Backlinko's analysis of 4 million search results found URLs containing the target keyword generate 45% more clicks than those without. That click-through rate difference itself is a behavioural signal that influences rankings over time.

Beyond keywords, clean URLs improve crawlability by eliminating duplicate parameter combinations that waste crawl budget and dilute ranking signals. They also reduce the likelihood of accidental duplicate content — a common SEO problem with dynamic URLs that generate multiple URLs for the same content (?sort=price, ?sort=rating, etc.).

So: clean URLs are not a magic ranking boost, but they eliminate multiple active ranking disadvantages simultaneously, while adding keyword and CTR benefits. That combination is significant enough to be worth prioritising in any site audit.

Will changing my URLs hurt my current rankings?

If done correctly — with proper 301 redirects — changing URLs should not hurt your rankings and may improve them over time. The 301 redirect tells Google that the page has permanently moved, and Google transfers the ranking signals (link equity, crawl history, engagement data) from the old URL to the new one. This process takes time — typically 2 to 8 weeks for rankings to stabilise after a URL change — but the end result should be neutral to positive.

The scenarios where URL changes hurt rankings are: forgetting to set up redirects (the old URL returns a 404, all link equity is lost), using 302 instead of 301 redirects (temporary redirect — Google does not transfer authority), and redirecting to a different page rather than the equivalent new URL (Google does not treat this as a moved page).

If your site has many URLs with significant backlinks, change them in small batches, monitor Google Search Console for any coverage errors, and give each batch time to stabilise before proceeding.

My site is on Nginx — can I use this tool's .htaccess code?

No — .htaccess files and mod_rewrite are Apache-specific. They do not work on Nginx. Nginx uses a completely different syntax for URL rewriting, configured in the nginx.conf or a site-specific configuration file.

The equivalent in Nginx for a basic rewrite would look like:

rewrite ^/old-page/?$ /new-page permanent;

And for parameter-based rewrites:

location ~ ^/products/([0-9]+)/?$ { rewrite ^ /products.php?id=$1 last; }

Unlike Apache's .htaccess approach (where each directory can have its own file), Nginx requires root server access to modify the configuration, and changes require an Nginx reload to take effect. If you are unsure which server you are on, contact your hosting provider or check your hosting control panel — cPanel typically indicates Apache, while Nginx hosting is usually explicitly mentioned.

What does the [R=301,L] flag mean and why is it important?

These are mod_rewrite flags that modify how a RewriteRule behaves:

  • R=301 — Redirect with HTTP status 301 (Permanent Redirect). This tells the browser to go to a new URL and update its bookmarks, and tells search engines to transfer the ranking signals from the old URL to the new one. Without this flag, the rewrite is internal (the browser address bar does not change). Without =301, a plain R defaults to 302 (Temporary), which does not transfer full SEO value.
  • L — Last. Stop processing further rules after this one matches. Without this flag, Apache continues evaluating remaining rules in the file, which can cause rules to interfere with each other and produce unexpected results. Always include L unless you deliberately want subsequent rules to also apply.

Other common flags you may see: QSA (Query String Append — adds existing query parameters to the rewritten URL), NC (No Case — makes the pattern match case-insensitively), and NE (No Escape — prevents special characters from being escaped).

My .htaccess changes are not working. How do I debug this?

The most common causes of .htaccess rules not working:

  • mod_rewrite is not enabled: Your Apache installation may not have mod_rewrite loaded, or the AllowOverride directive in the server configuration may not allow .htaccess overrides in your directory. Contact your hosting provider to confirm mod_rewrite is available and AllowOverride is set to All.
  • RewriteEngine On is missing: Every .htaccess file using mod_rewrite must begin with RewriteEngine On. If this line is missing or misspelled, no rules will execute.
  • Syntax error in the file: A single typo in your .htaccess file causes a 500 Internal Server Error. If your site goes down after editing .htaccess, restore your backup immediately and check the syntax carefully against the generated code from this tool.
  • Rule order conflict: mod_rewrite processes rules from top to bottom and stops at the first match with an [L] flag. If a rule higher in the file is matching when it should not be, add more specific RewriteCond conditions before it.
  • Browser caching the old URL: After implementing a redirect, your browser may have cached the old response. Test in an incognito window, or use a tool like our Redirect Checker to verify the server-side behaviour.
Should I include or exclude the trailing slash in my clean URLs?

Either is fine for SEO — but you must be completely consistent. The problem arises when both example.com/page and example.com/page/ return content, because search engines may treat these as two different URLs and create a duplicate content issue.

The common convention is: directories use trailing slashes (/category/) and specific pages do not (/about). However, many sites pick one approach and apply it everywhere. Whichever you choose, add a RewriteRule to 301 redirect the other version to your preferred one:

To remove trailing slashes: RewriteRule ^(.*)/$ /$1 [R=301,L]

To enforce trailing slashes: RewriteCond %{REQUEST_FILENAME} !-f then RewriteRule ^([^/]+)$ $1/ [R=301,L]

Once you choose a standard, maintain it across your entire site and update your sitemap to reflect the canonical version.

Is the URL Rewriting Tool free? Any limits?

Yes — completely free with no account, no sign-up, and no usage limits. You can rewrite as many URLs as you need and generate as many .htaccess code blocks as your site requires. This applies to all 47 free tools on DigitalSub Pro — there is no premium tier and no paywall on any feature.