.htaccess 301 Redirect Generator

    Create Apache .htaccess rules for WWW, HTTPS and individual URL redirects.

    Runs in your browser, no data sent Free · No sign-up required

    Force redirect to HTTPS

    Domain preference

    RewriteEngine On
    
    # Redirect to HTTPS
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    
    # Remove www
    RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
    RewriteRule ^(.*)$ https://%1%{REQUEST_URI} [L,R=301]
    
    # Custom 301 redirects
    Redirect 301 /eski-sayfa /yeni-sayfa
    Redirect 301 /blog/eski https://clou.tr/blog/yeni

    .htaccess redirects

    .htaccess files are most commonly used to create 301 (permanent) redirects that move visitors and search engines to the right address. This tool prepares the most commonly needed rules for you.

    • Force HTTPS: Moves all traffic to a secure connection
    • www / non-www: Sets a single preferred domain and prevents duplicate content
    • 301 redirect: Preserves the SEO value of moved pages

    Add the generated rules to the .htaccess file in your site's root directory. A valid SSL certificate is required for the HTTPS redirect.

    Frequently Asked Questions

    .htaccess is a hidden file that provides per-directory configuration on Apache web servers. It lets you change settings such as URL redirects, access control, caching and security rules without touching the server's main configuration.

    A 301 is a 'permanent' redirect and transfers the page's SEO value (link juice) to the new address; use it for pages that have moved. A 302 is a 'temporary' redirect and does not transfer SEO value; it is preferred only for short-term situations.

    Both are equivalent for SEO; what matters is picking one and being consistent. Having both versions accessible causes a 'duplicate content' problem. The right approach is to choose one preference and 301-redirect the other to it.

    Google treats HTTPS as a ranking signal, and browsers mark HTTP sites as 'not secure'. Redirecting all HTTP traffic to HTTPS is essential for security, SEO and user trust. This requires a valid SSL certificate.

    Fast, secure, Turkey-based hosting

    Move your website to Clou.TR with NVMe SSD, free SSL and a 99.9% uptime guarantee.