0

I have added ssl for site and now i wanna use redirect in htaccess.

I have this one in htaccess:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteCond %{HTTPS} !=on
#RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R,QSA]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

What and where should i add for redirect? Th for help

Narkomax
  • 3
  • 1

2 Answers2

0

Using the following code in your .htaccess file automatically redirects visitors to the HTTPS version of your site:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On

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

RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Sinha
  • 512
  • 4
  • 11
  • And where i should paste this code in my code? – Narkomax Nov 11 '17 at 11:31
  • Is it OK? `# BEGIN WordPress RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] ` – Narkomax Nov 11 '17 at 11:33
  • @Narkomax, you need to add this in you .htaccess file and put the file in your project root folder. – Sinha Nov 11 '17 at 11:33
  • I mean add code that you type before all my code or after? I mean where past this small piece – Narkomax Nov 11 '17 at 11:36
  • @Narkomax Just updated the code. Please check that. – Sinha Nov 11 '17 at 11:41
  • This is what ended up working for me RewriteEngine On RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] – Travis Weerts Jul 06 '21 at 01:45
-1

You should paste this .htaccess file into your project root.