Issues with .htaccess 301 redirect with site on subdirectory

[ad_1]

Hello,

I have a site installed on a subdirectory that way:
mydomain.com/mysite/
that works fine but, in some cases, when I type manually this address as above in the browser it gets redirected to the root domain mydomain.com.

I found this snippet in my .htaccess file, generated by RSSSL:

RewriteEngine on
RewriteCond %{HTTPS} !=on [NC]RewriteCond %{REQUEST_URI} !wp-content\/cache\/(all|wpfc-mobile-cache) RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

I followed the instructions in your documentation here and I first removed this snippet and also added the “define” line of code in wp-config.php. But I have the following questions:

  • First of all, I have to say that removing this snippet solves my problem. But simply removing it and adding that “define” line in wp-config.php is not enough as you also need to go at the settings and switch to PHP redirection, otherwise the snippet gets added anyway…
  • otherwise, is there a way to correct this snippet so that it works on sites installed in sub-directories?

    Thanks.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer