Generate .htaccess redirect rules for Apache: single page and folder 301s, domain moves, HTTP to HTTPS, www or non-www, trailing slashes and extensions.
On this page
About this tool
Generate .htaccess rules for 301 redirects, www and HTTPS redirects and more.
How to use HTACCESS Redirect Generator
Choose the redirect type and status code (301 for permanent moves).
Fill in the paths or domains the rule needs.
Copy the code to the top of the .htaccess file in your site’s root folder and test it in a private window.
Worked example
To move to HTTPS and www in one hop, choose “HTTP to HTTPS and www”. The rule sends http://example.com/page straight to https://www.example.com/page.
Does this work on Nginx?
No. .htaccess files are read by Apache and LiteSpeed. Nginx uses return or rewrite directives in its server configuration.
Why test in a private window?
Browsers cache 301 redirects, so an old rule can keep working in your normal window even after you change it.
Explore Webmaster & SEO Tools · More practical guides
Personalize your experience. Open with Ctrl+U (Option+U on Mac). Preferences stay in this browser when storage is available.
Menu language English (USA) Español اردو
Accessibility Profiles Custom settings Vision support Reading support Reduced motion Motor support Focus support
Oversized widget
Screen Reader
Contrast +
Smart Contrast
Highlight Links
Bigger Text
Text Spacing
Pause Animations
Dyslexia Friendly
Cursor
Tooltips
Page Structure
Line Height
Text Align
Dictionary
Saturation
Read aloud assistance Uses browser speech voices to read page text or selected text. This is not a replacement for NVDA, VoiceOver or another full screen reader. Available voices and speech processing depend on your browser and device.
Read page Read selection Pause / resume Stop reading
Reset All Accessibility Settings Move / Hide Widget Widget positionBottom right Bottom left Hide widget for 1 hour Restore at any time with Ctrl+U (Option+U on Mac).
Accessibility statement and help