URL Rewriting Tool

Convert dynamic URLs with query strings into clean SEO-friendly static URLs in multiple rewrite formats

URL Rewriting Tool

About URL Rewriting

Why Rewrite URLs?
  • Better for SEO
  • Easy to remember
  • Higher CTR
Example
Before ?id=1&cat=5
After /page/1/5/

A URL rewriting tool converts dynamic URLs with query parameters into clean, SEO-friendly static URLs. It generates rewrite rules for web servers (e.g., Apache mod_rewrite) so that ugly URLs like page.php?id=1&cat=2 become readable URLs like page-id-1-cat-2.html. The tool helps improve SEO, user experience, and link structure.

What is URL Rewriting Tool?

The URL Rewriting Tool is a free online tool that takes a dynamic URL with query parameters and produces multiple rewrite formats. You paste a URL such as https://www.domain.com/test.php?categoryid=1&productid=10, and the tool parses it to extract the host, path, and query string. It generates four types of rewrite rules: Type 1 uses hyphens (e.g., test-categoryid-1-productid-10.html), Type 2 uses slashes (e.g., test/categoryid/1/productid/10.html), Type 3 uses hyphens with trailing slash (e.g., test-categoryid-1-productid-10/), Type 4 uses slashes with trailing slashes (e.g., test/categoryid/1/productid/10/). For each type, the tool outputs the Apache RewriteRule and example URLs. The URL must contain a query string; otherwise the tool reports an error. The tool is designed for dynamic URLs with parameters.

Dynamic URLs with query strings are common in content management systems, e-commerce platforms, and custom web applications. While functional, they can be long, ugly, and less memorable. Search engines and users generally prefer clean URLs. The URL Rewriting Tool automates the process of converting these dynamic URLs into SEO-friendly static formats. It generates the exact Apache mod_rewrite rules you need to add to your .htaccess file. Each format has different aesthetics: hyphen-based URLs are compact, slash-based URLs resemble directory structures. Choose the format that best fits your site's design and SEO strategy.

Implementing URL rewriting requires server configuration. For Apache, add the generated rules to your .htaccess file in the document root or the directory that handles the URLs. Ensure mod_rewrite is enabled. The rules use regex capture groups to map the clean URL segments back to query parameters. Your application must be able to read these parameters. Many frameworks (e.g., WordPress, Laravel) have built-in support. For custom PHP, use $_GET to read the parameters. When migrating from dynamic to clean URLs, set up 301 redirects from old URLs to new ones to preserve SEO value. The tool generates the rewrite rules; you are responsible for implementing them and testing. Use a staging environment first. Verify that all parameter combinations work correctly. Check that relative links and canonical URLs are updated.

The tool requires a URL with a query string. If your URL has no query parameters, the tool will report an error. Example valid input: https://example.com/page.php?id=1&cat=2. The tool parses the query string and generates rules for each parameter. The output includes the RewriteRule and the internal mapping. The example URLs show the clean format with the actual values from your input. The format example shows the pattern with placeholders. Use the example to verify the rule works before deploying. The tool supports URLs with or without a filename in the path. For /index.php?param=1, the file is index.php. For /?param=1, the file may be empty depending on the path. The tool handles both cases. The generated rules are designed for Apache. If you use Nginx, you will need to convert the rewrite logic. Nginx uses a different syntax for capturing and redirecting.

Who Benefits from This Tool

Web developers and system administrators use it to configure Apache mod_rewrite or similar. SEO professionals improve URL structure for search engines. Content managers migrate from dynamic to static URLs. E-commerce site owners clean product and category URLs. Anyone who needs to convert query-string URLs to clean, readable URLs can benefit.

Key Features

Four Rewrite Formats

Type 1: parameter-name-value with hyphens, ending in .html. Type 2: parameter-name/value with slashes, ending in .html. Type 3: same as Type 1 but with trailing slash. Type 4: same as Type 2 but with trailing slashes. Each format has different aesthetics and SEO implications.

Type 1 produces compact URLs like product-categoryid-1-productid-10.html. Type 2 produces directory-style URLs like product/categoryid/1/productid/10.html. Type 3 and 4 use trailing slashes, which some sites prefer for consistency. Search engines can index all formats; choose based on your site's design. Hyphen-based URLs are common for SEO. Slash-based URLs can imply hierarchy. The tool generates the exact RewriteRule pattern for each format. The pattern uses regex capture groups ($1, $2, etc.) to map the clean URL back to query parameters.

Apache RewriteRule Output

For each type, the tool outputs the RewriteRule and RewriteCond directives needed for Apache. The rules map the clean URL back to the original query string.

Example URLs

Example URLs show the actual clean URL with the current parameter values, and a format example with placeholder (Any Value) for documentation.

Host and Path Handling

The tool correctly handles paths with or without a filename. It extracts the path, file, and query parameters for accurate rule generation.

Port and Scheme Support

URLs with custom ports and schemes (http/https) are supported. Example URLs include the full scheme and host.

How to Use

  1. Paste or type a dynamic URL that includes a query string (e.g., ?param1=value1¶m2=value2).
  2. Complete the captcha if required.
  3. Click the process button.
  4. Review the four rewrite types and their generated rules and example URLs.
  5. Copy the RewriteRule and related directives for your Apache .htaccess or config.
  6. Configure your web server to use the rules. Ensure mod_rewrite is enabled.

Common Use Cases

  • Converting product URLs for e-commerce sites
  • Creating SEO-friendly category and archive URLs
  • Migrating from dynamic to static URL structure
  • Configuring Apache mod_rewrite rules
  • Documenting URL structure for development teams
  • Improving user experience with readable URLs
  • Reducing URL length for sharing and tracking
  • Standardizing URL format across a site

Tips & Best Practices

Choose a format that matches your site's style and is consistent across pages. Type 1 (hyphen) is common for SEO. Ensure your server supports the chosen format (trailing slashes may need redirects). Test the rules in a staging environment before production. Consider 301 redirects from old URLs to new ones when migrating. Keep parameter names short and meaningful. Use URL encoding for values that contain special characters.

Limitations & Notes

The tool generates rules for Apache mod_rewrite. Other servers (Nginx, IIS) require different syntax. The tool assumes a specific URL structure; complex or nested parameters may need manual adjustment. The generated rules are templates; you may need to adapt them for your server configuration. The tool does not implement the rules; it only generates them. You must add them to your .htaccess or server config.

FAQs

Why does the tool say the URL is not dynamic?

The tool requires a query string (e.g., ?param=value). URLs without a query string are rejected.

What is the difference between the four types?

Type 1: param-value.html. Type 2: param/value.html. Type 3: param-value/. Type 4: param/value/. They differ in separators and trailing slashes.

What is mod_rewrite?

mod_rewrite is an Apache module that rewrites URLs. It allows mapping clean URLs to internal scripts.

Can I use this for Nginx?

The tool outputs Apache syntax. For Nginx, you would need to convert the RewriteRule logic to Nginx rewrite directives.

Do I need to change my PHP code?

Your PHP code may need to read parameters from the rewritten URL. The exact implementation depends on your framework or routing setup.

What if my URL has many parameters?

The tool handles multiple parameters. Each becomes part of the clean URL pattern. Very long URLs may become unwieldy.

What is the (Any Value) in the example?

It's a placeholder showing the format. The actual value would be substituted for real URLs.

Does the tool support POST parameters?

No. The tool only processes query string parameters visible in the URL.

What about URL encoding?

Parameter values with special characters should be URL-encoded. The tool uses the values as provided.

Can I use this for REST APIs?

The tool is designed for traditional page URLs. REST APIs often use different routing patterns. For REST, you typically use framework routing rather than server rewrite rules.

What if my URL has special characters?

URL-encode special characters before pasting. The tool uses the values as provided. Parameter values with spaces or symbols should be properly encoded.

Does the tool work with HTTPS?

Yes. The tool preserves the scheme (http or https) in the example URLs it generates. Your rewrite rules work regardless of protocol.

What is the difference between the path and the file?

The path is the full path component of the URL (e.g., /products/category.php). The file is the last segment (e.g., category.php). The tool uses this to construct the rewrite rule correctly.

Can I use the generated rules in Nginx?

The output is Apache syntax. Nginx uses a different format. You would need to convert the logic to Nginx rewrite directives, which use a different syntax for capturing and redirecting.

What is the RewriteRule format?

Apache RewriteRule has the pattern: RewriteRule pattern substitution [flags]. The pattern matches the clean URL. The substitution maps to the internal URL with query parameters. The [L] flag means last rule.

What is the RewriteRule pattern?

The pattern uses regex. For example, ^test-categoryid-(.*)-productid-(.*)\.html$ matches test-categoryid-1-productid-10.html and captures 1 and 10. The captures become $1 and $2 in the substitution.

Do I need to enable mod_rewrite?

Yes. Apache's mod_rewrite module must be enabled. On many hosts, it is enabled by default. For .htaccess, AllowOverride must be set to allow FileInfo.

What is the difference between Type 1 and Type 3?

Type 1 ends with .html (e.g., page.html). Type 3 ends with a trailing slash (e.g., page/). The rewrite rules differ accordingly. Some sites prefer trailing slashes for URLs.