Back to Tools
URL Rewriting Tool
Generate professional URL rewrite rules for Apache, Nginx, and IIS servers. Create redirects, clean URLs, and optimize your website structure for better SEO.
Multi-Server Support
Apache, Nginx, and IIS configurations
Custom Rules
Create redirects and rewrites easily
SEO Optimized
Improve site structure and rankings
URL Rewriting Tool
Generate URL rewrite rules for Apache, Nginx, and IIS servers to improve SEO and user experience
Configuration
Test URL
Generated Rules
Click "Generate Rules" to create your URL rewrite configuration
Common Rewrite Rules
Remove www from URLs
R=301, L
Pattern:
^www\.(.*)$
Replacement:
$1
www.example.com/pageβexample.com/page
Add www to URLs
R=301, L
Pattern:
^(?!www\.)(.*)$
Replacement:
www.$1
example.com/pageβwww.example.com/page
Force HTTPS redirect
R=301, L
Pattern:
^(.*)$
Replacement:
https://%{HTTP_HOST}%{REQUEST_URI}
http://example.com/pageβhttps://example.com/page
Remove trailing slash
R=301, L
Pattern:
^(.+)/$
Replacement:
$1
/page/β/page
Add trailing slash to directories
R=301, L
Pattern:
^([^.]*[^/])$
Replacement:
$1/
/pageβ/page/
Clean URLs (remove .php extension)
L
Pattern:
^([^.]+)$
Replacement:
$1.php
/contactβ/contact.php
Apache URL Rewriting Guide
Getting Started with Apache mod_rewrite
Apache's mod_rewrite module is one of the most powerful tools for URL manipulation. It uses regular expressions to match URL patterns and can perform redirects, rewrites, and other URL transformations.
Basic Syntax
RewriteEngine On RewriteRule Pattern Substitution [Flags]
Common Flags
- R=301 - Permanent redirect (SEO-friendly)
- R=302 - Temporary redirect
- L - Last rule, stop processing
- QSA - Query String Append
- NC - No Case (case-insensitive)
Best Practices
- Always use 301 redirects for permanent changes to preserve SEO value
- Test rules thoroughly before deploying to production
- Use the L flag to prevent unnecessary processing
- Comment your rules for future maintenance
SEO Benefits of URL Rewriting
Improved User Experience
- β’ Clean, readable URLs that users can understand
- β’ Consistent URL structure across your site
- β’ Elimination of duplicate content issues
- β’ Better sharing and bookmarking experience
Search Engine Benefits
- β’ Consolidated link equity through proper redirects
- β’ Improved crawl efficiency for search bots
- β’ Better keyword targeting in URLs
- β’ Reduced bounce rates from clean URLs
Important: Always test URL rewrite rules in a staging environment before deploying to production. Incorrect rules can break your website or cause SEO issues. Make sure to backup your configuration files before making changes.