HTAccess Redirect Generator
Create correct 301 and 302 redirect rules for Apache's `.htaccess` file.
Feeling stressed? I use Miracle of Mind app daily - see why It got 1M+ downloads! (not affiliated)Feeling stressed? I use Miracle of Mind daily.Try it now! Try it now
Create correct 301 and 302 redirect rules for Apache's `.htaccess` file.
# Redirect rules generated by DevDreaming Dev Tools # 301 Permanent Redirects (SEO-friendly, tells search engines the page has moved permanently) Redirect 301 /old-page /new-page
# Force HTTPS
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]# Redirect www to non-www
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]# Redirect non-www to www
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]# Redirect entire old domain to new domain
RewriteEngine On
RewriteCond %{HTTP_HOST} ^olddomain\.com$ [NC]
RewriteRule ^(.*)$ https://newdomain.com/$1 [R=301,L]• .htaccess files configure Apache web servers (upload to site root)
• 301 Permanent: Tells search engines the page has moved forever (passes SEO value)
• 302 Temporary: Page moved temporarily (doesn't pass SEO value)
• Test redirects after uploading to ensure they work correctly
• Use absolute URLs (with https://) for external redirects
• Backup your .htaccess file before making changes