• Resolved Sergio

    (@wordthem)


    Hello Maciej!

    Nice to contact you!

    I have encountered a duplicity problem. The www redirection does not work without my www .httacces in the pages where I use Permalink Manager.

    Any ideas?

    Thank you
    Sergio

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Maciej Bis

    (@mbis)

    Hi Sergio,

    I will take a look at this on my development server and will let you know once I fix it.

    Best regards,
    Maciej

    Plugin Author Maciej Bis

    (@mbis)

    Could you also send me your .htaccess code?

    Thread Starter Sergio

    (@wordthem)

    There goes Maciej,

    RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$
    RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteRule ^/?$ “https\:\/\/mydomain\.com\/” [R=301,L]

    I have also tried with this format;

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www.mydomain.com [NC]
    RewriteRule ^(.*)$ https://mydomain.com/$1 [L,R=301]

    Thank you
    Sergio

    Plugin Author Maciej Bis

    (@mbis)

    Hi Sergio,

    please make sure that the rewrite rules are placed in the beginning of code. Could you try to use this code instead?

    RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
    RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteRule ^(.*)$ https://%1/$1 [R=301,L]

    Anyway, I wonder what is exactly wrong – the .htaccess rewrite rules are executed before PHP scripts, so the .htaccess redirect should be done before my plugin is even loaded.

    Best regards,
    Maciej

    Thread Starter Sergio

    (@wordthem)

    Hello Maciej,

    With these rules that you have passed me if it works in the pages where Permalink Manager is running, how is it?

    With the previous rule that sent you the redirection worked, but only in those pages where the plugin was not running.

    A greeting
    Sergio

    Plugin Author Maciej Bis

    (@mbis)

    Hi Sergio,

    I think that the old redirect code did not work in .htaccess code and the redirect was done with wp_redirect() function (using PHP). My plugin stops the canonical redirect if the custom permalink is detected and that is probably why it did not work on pages with custom permalinks defined.

    Best regards,
    Maciej

    Thread Starter Sergio

    (@wordthem)

    Hello Maciej,

    Thank you very much for the explanation and your quick resolution and support ??

    Thank you
    Sergio

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Redirect domain without www does not work’ is closed to new replies.