Migrating a website, changing your permalink structure, or moving domains requires careful URL redirection. If handled incorrectly, broken links will frustrate users and damage your search engine rankings. Writing Apache .htaccess server rules manually can be complicated and risky—a single misplaced slash can cause an Internal Server Error (500 error) or infinite redirection loops.
Our free .htaccess Redirect Generator allows you to instantly build clean, syntax-verified redirection rules for your Apache server in seconds.
1.Select Your Redirect Type:
Choose whether you need a permanent 301 Redirect (best for SEO and permanent page moves) or a temporary 302 Redirect.
2.Enter Source and Destination:
Input your old URL path (the source) and your new target URL path (the destination). You can target single pages or entire folders using wildcards.
3.Copy and Paste:Ready for your server.
View your generated Apache code block in real time. Click "Copy Code" and paste it directly into the .htaccess file located in your website's root directory.
Choosing the correct redirect status code protects both your user experience and your SEO performance:
301 Permanent Redirect: This tells search engines (like Google) that the page has moved permanently to a new location. It passes roughly 90% to 99% of your hard-earned link equity (SEO "link juice") from the old URL to the new one. Use this for site migrations, domain changes, or deleted pages.
302 Temporary Redirect: This informs search engines that the move is only temporary and that they should continue indexing the original URL. Use this during website maintenance, A/B testing, or seasonal product page updates.
Beyond simple page-to-page mappings, our tool helps you configure crucial server-level rules:
Force HTTPS Redirection: Automatically route all unsecured HTTP traffic to secure encrypted HTTPS connections, satisfying modern browser security standards.
WWW vs. Non-WWW Normalization: Force your entire domain to load consistently with or without the www prefix, preventing duplicate content indexing issues in search engines.
Wildcard Folder Redirects: Shift an entire subdirectory of old pages to a new directory structure using regular expression matching (RewriteRule).
Your server configuration details are strictly confidential. Our .htaccess Generator runs entirely using client-side JavaScript. Your URLs, file paths, and domain structures are processed locally in your web browser and are never stored, saved, or viewed on our servers.
Where is the .htaccess file located on my server?
The .htaccess file is typically located in the root public directory of your website (often named public_html, www, or httpdocs). Because file names starting with a dot are hidden by default in many FTP clients and file managers, ensure your settings are configured to "Show Hidden Files."