DEV Community 👩‍💻👨‍💻

Fa'rath Shba 🚀
Fa'rath Shba 🚀

Posted on

Use .htaccess to redirect HTTP to HTTPs

This post is for individuals who are looking for quick fixes to redirect HTTP to HTTPS traffic.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# BEGIN WordPress
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Find and follow new tags! 🤔 Did you know?   DEV has a variety of tags to help you find the content you like. Find and follow your favorite tags