• Resolved John

    (@dsl225)


    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.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Rogier Lankhorst

    (@rogierlankhorst)

    Currently this is not supported, but I’ll add it to our roadmap.

    For now I would recommend to set the setting to the PHP redirect. The constant you used has been deprecated from the plugin, so no longer works. I’ve updated the article, thanks for reporting that!

    Thread Starter John

    (@dsl225)

    Thanks, but please clarify because I’m lost here.

    • what precisely is NOT supported, what is “this”?
    • what is a “constant” and to what are you referring precisely please?
    • when reading this updated page, I understand that I first have to add a “define” line and then remove it again? But, for me, the .htaccess is now OK (after changing the settings to PHP), so what should I do, just remove the previous “define” line in wp-config.php?

      Thanks.
    Plugin Contributor Rogier Lankhorst

    (@rogierlankhorst)

    @dsl225 I’m sorry, I’ll explain better.

    – RSSSL_SAFE_MODE and the older one are both constants, added with a ‘define’
    – The adding of the constant RSSSL_SAFE_MODE is only to prevent the plugin from re-adding the .htaccess redirect during the change to the php redirect. As you’ve already done that, you can skip that. You can remove the old constant for the same reason.
    – With not supported I was referring to your setup, with our .htaccess redirect i.c.w a subfolder setup, as you are redirected to the root. I suspect though that there is some other .htaccess redirect interfering with this one, as the RSSSL redirect is a generic one. Because this line

    https://%{HTTP_HOST}/$1

    should just redirect to the same url with https. It is possible that it would work correctly if the order of the .htaccess lines (RSSSL lines first, or the other lines first) is changed.

    Do you have another .htaccess file in the root of the setup, or more lines in the subfolder .htaccess? If so, can you share what they contain?

    Thread Starter John

    (@dsl225)

    Thanks for this, I understand.

    No, there is no other .htaccess but this one has also some snippets from WP Fastest Cache like this one:

    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTPS} =on
    RewriteCond %{HTTP_HOST} ^mydomain.com

    But I think I prefer leave things as they are now because everything works fine and I don’t it would be useful to investigate further about the 301 redirection in .htaccess.

    You should rather maybe add something about subdirectories in your plugin’s FAQ.

    Thanks for your help!

    Plugin Contributor Rogier Lankhorst

    (@rogierlankhorst)

    Will do!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Issues with .htaccess 301 redirect with site on subdirectory’ is closed to new replies.