.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.
- Free, no sign-up
- Nothing is sent to a server
- Worldwide
How to use .htaccess Redirect Generator online
- List the redirects. Old path, a space, new address.
- Choose the code. 301, 302, 307 or 308.
- Choose HTTPS and www. And hide directory listings if you like.
- 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?
Where does the file go?
Does it work on Nginx?
How do I force HTTPS?
Why test with a 302 first?
Can anyone see the text I put into the .htaccess Redirect Generator?
Can I chain the .htaccess Redirect Generator with another tool?
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.