URL Rewriting Tool

URL Rewriting Tool — a free online tool.

Add to .htaccess

    

Turning query-string URLs into clean paths

Clean URLs like /product/42 are easier to read, share, and rank than query-string URLs like product.php?id=42. Enter your script name, the query parameter it expects, and the URL prefix you want to use, and this tool generates the Apache mod_rewrite rule that maps the clean URL to your existing script - no code changes needed on your end, since the server transparently rewrites the request.

Why clean URLs tend to perform better for SEO and sharing

A clean, readable URL conveys what a page is about at a glance, which both search engines and users find more meaningful than an opaque query string - it's also more resistant to looking broken or suspicious when shared on social media or in a chat, where a long string of parameters can get truncated or flagged by some platforms' link previews.

Why this requires no changes to the script itself

mod_rewrite operates at the web server level, intercepting the incoming request and internally rewriting it to the query-string form before your script ever runs - your PHP code still receives exactly the same query-string parameter it always expected, which is why adding this rule retrofits clean URLs onto an existing site without touching a single line of application code.

Why [L,QSA] specifically appears at the end of the generated rule

[L] tells Apache this is the last rule to check for a matching request, preventing it from continuing to evaluate rules that might also match and cause unexpected double-rewriting. [QSA] (Query String Append) preserves any additional query parameters a visitor's URL might already carry, merging them with the rewritten request rather than silently dropping them.

Perguntas frequentes

Do I need to change my PHP code after adding this rule?

No - mod_rewrite rewrites the incoming request internally before your script runs, so your script still receives the same query parameter it always expected (the id parameter, for example).

What does the [L,QSA] at the end mean?

[L] tells Apache to stop processing further rewrite rules once this one matches. [QSA] (Query String Append) preserves any additional query parameters in the original request instead of discarding them.

Why do clean URLs tend to perform better for SEO?

A clean, readable URL conveys what a page is about at a glance to both search engines and users, and it's more resistant to looking broken or being truncated when shared on social media.

Does this work on servers other than Apache?

No - this generates a mod_rewrite rule, which is specific to Apache (and compatible servers like LiteSpeed). Nginx uses a different rewrite syntax and would need its own equivalent rule.

Can I use this for more than one script on the same site?

Yes - generate and add a separate rule for each script/prefix combination you need; multiple mod_rewrite rules can coexist in the same .htaccess file.

Mais em Technical SEO & Site Management