Enter a URL
Imagine sending a customer a link like product.php?id=42&cat=7. It opens the right page, but the address says nothing about the content, and the query string makes it look like a tracking link. A readable address such as /test-firstid-1-secondid-10.htm solves that, as long as the server knows how to map it to the script that already runs.
The URL Rewriting Tool on ONE SEO Tools generates the Apache rewrite rules that make this mapping work. You keep your existing script and publish the readable address. This guide covers the two patterns, how to upload the code, and what you still need to check yourself.
The tool supports two patterns. Type 1 produces a single-page address that ends in .htm and carries two hyphen-separated values. Type 2 produces a folder-style address where each value sits between slashes. For each type, the page shows a generated URL, an example URL with placeholders such as (Any Value), and a block of .htaccess code.
The tool generates rule text and nothing more. It does not upload the file, update your internal links, create 301 redirects for old addresses, or confirm that your script handles the values the rule passes along.
The Type 1 block has two directives. Options +FollowSymLinks enables a feature mod_rewrite relies on, and RewriteEngine on turns the engine on. Some shared hosts restrict Options in .htaccess, so if you get a 500 error, ask your host whether per-directory overrides are allowed.
Options +FollowSymLinks
RewriteEngine on
RewriteRule test-firstid-(.*)-secondid-(.*)\.htm$ test.php?firstid=$1&secondid=$2
Each (.*) group captures the text in one position, and the rule passes it to test.php as $1 or $2. Visitors see the clean address while the server runs test.php?firstid=1&secondid=10. Because (.*) accepts any characters, the script should validate its inputs rather than rely on the rule to filter them.
Type 2 uses two rules, one matching the path with a trailing slash and one without, so both forms reach the page.
Options +FollowSymLinks
RewriteEngine on
RewriteRule test/firstid/(.*)/secondid/(.*)/ test.php?firstid=$1&secondid=$2
RewriteRule test/firstid/(.*)/secondid/(.*) test.php?firstid=$1&secondid=$2
Type 1 suits flat collections of pages you want to look like files. Type 2 suits content grouped into categories, where the folders reflect the hierarchy.
| Feature | Type 1 | Type 2 |
|---|---|---|
| URL ending | .htm | Folder path with a trailing slash |
| Example | /test-firstid-1-secondid-10.htm | /test/firstid/1/secondid/10/ |
| Best for | Flat pages that should look like files | Categorized content with a clear hierarchy |
If your values are always numbers, you can restrict the match yourself. The anchors ^ and $ limit the rule to the full path, and [0-9]+ accepts digits only. The generated code does not include these restrictions, so test a manual version on a staging copy first. The Apache mod_rewrite documentation lists every directive and flag.
RewriteRule ^test-firstid-([0-9]+)-secondid-([0-9]+)\.htm$ test.php?firstid=$1&secondid=$2 [END]
RewriteRule ^test/firstid/([0-9]+)/secondid/([0-9]+)/?$ test.php?firstid=$1&secondid=$2 [END]
The [END] flag stops Apache from applying further rewrite rules after a match. Use it only on the rule that should run last.
The generator does not check that your server supports mod_rewrite, edit your pages, or create permanent redirects from old addresses. It also does not verify that the PHP script behind the rule is secure. Treat the output as a draft to review and test before it goes live.
Clean URLs do not improve rankings on their own. What protects your results is keeping each page's content and signals intact when its address changes. Start with a mapping sheet that pairs every old address with its new one. Each old page should return a permanent 301 redirect to its matching new page, not to the homepage, since sending everything to one page leaves visitors and search engines without the content they wanted. Google's guidance on 301 redirects explains how these pass signals to the new address.
After the switch, point internal links directly at the new addresses instead of relying on redirects. Update canonical tags, submit an updated XML sitemap, and look for redirect chains, where an old address takes two hops to arrive. Google's site move guidance covers these steps in more detail.
Then monitor the results. The Pages report in Google Search Console shows indexing problems, and the performance data shows whether clicks hold steady. The Google Index Checker can spot-check that new addresses are indexed, and the WWW Redirect Checker confirms that only one version of your domain resolves. To build the redirect rules, the HTAccess Redirect Generator is the natural next step.
Before switching any links, test one generated address, confirm your redirect map, and check the search data for several weeks afterward. Most problems show up in one of those three places.