Menu
PDF Tools
Image Tools
Converters & Utilities
Seller & Print Tools
Accounting & Business
Calculators
Text & Writing Tools
Developer & Web Tools
Creator & Social Tools
Browser Utilities & Games
Document & Design Makers
Text & Developer Tools
Exam & Form Tools

.htaccess Redirect Generator

This tool writes .htaccess rules for Apache. It makes page redirects with the code you choose, sends visitors to HTTPS, sets the www form and hides directory listings.

How to use .htaccess Redirect Generator online

  1. List the redirects. Old path, a space, new address.
  2. Choose the code. 301, 302, 307 or 308.
  3. Choose HTTPS and www. And hide directory listings if you like.
  4. Copy the rules. Add them to .htaccess and test.

Why use this free .htaccess Redirect Generator

  • Four redirect codes
  • HTTPS rule
  • www or bare domain
  • Directory listings hidden
  • Checks each line
  • Share by link

What .htaccess does

On an Apache server, an .htaccess file in a folder changes how the server treats that folder and what is below it, without editing the main configuration. Redirects are one of the most common uses: when a page moves, a redirect sends visitors and search engines to the new address.

Redirects

Type one redirect on each line: the old path, a space and the new address, which can be a path or a full address. The tool writes a Redirect line for each with the code you choose. A 301 or 308 says the move is permanent. A 302 or 307 says it is temporary. Use a permanent code when the old address will never come back.

A worked example

The three lines in the sample become 3 rules:\nOptions -Indexes

Redirect 301 /old-page /new-page Redirect 301 /blog/old-post https://example.com/blog/new-post Redirect 301 /sale /offers\nOptions add rewrite rules to send visitors to HTTPS or to settle on www or the bare domain, and a line to hide directory listings.

HTTPS and www

The rewrite rules need mod_rewrite, and the Redirect lines need mod_alias; both are standard on most hosts. Pick one form of your domain, with or without www, and send the other to it, so that search engines see a single site. The tool writes the condition and the rule for the choice, and sends to HTTPS in the same step when both are on.

Test with care

A mistake in .htaccess can make a whole site return an error, so keep a copy of the old file and test right after you save. Browsers remember permanent redirects, so try a temporary one first and switch to permanent when you are sure. This page writes text only and cannot test your server. Nginx sites use a different file; see the Nginx tool.

Using the tool

The .htaccess Redirect Generator works again whenever the text or an option changes. Press Try a sample to see how it behaves.

.htaccess Redirect Generator: frequently asked questions

What is the difference between 301 and 302?
301 is permanent and 302 is temporary.
Where does the file go?
In the top folder of the site, or the folder it should apply to.
Does it work on Nginx?
No. Nginx has its own configuration.
How do I force HTTPS?
Choose Yes for HTTPS and the rewrite rule is written.
Why test with a 302 first?
Browsers remember 301 redirects and are slow to forget a mistake.
Can anyone see the text I put into the .htaccess Redirect Generator?
Your text stays on this device when you use the .htaccess Redirect Generator. The editor may keep the last text locally and offers to bring it back; you can dismiss it.
Can I chain the .htaccess Redirect Generator with another tool?
Yes. Copy the .htaccess Redirect Generator result, or press Use result as input and carry on with the new text.

Related searches for .htaccess Redirect Generator

  • .htaccess Redirect Generator online
  • free .htaccess Redirect Generator
  • .htaccess Redirect Generator online free
  • .htaccess Redirect Generator for mobile
  • .htaccess Redirect Generator without sign up
  • .htaccess Redirect Generator – Text & Writing Tools

.htaccess Redirect Generator is a free online tool on MAITBOX, in the Text & Writing Tools group. It runs in your browser, so what you type is not sent to a server. It works on Android and iPhone, and on Windows, Mac and Linux, with no download and no account.

More tools in Text & Writing Tools →

Search tools