• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved 301 Redirect Page via htaccess File

Sally1

Regular Pleskian
Hello,


I would like to do my redirects via htaccess File. I have for example the following code:

<IfModule mod_rewrite.c>

RewriteRule ^business-coach-layout/$ https://mydomain.com/business-layout/ [R=301,L]

</IfModule>

When i add the code snippet to the htaccess File the Redirect is not working.



I changed the snippet already to this, but the Redirect is still not working:

RewriteEngine On

RewriteRule ^business-coach-layout/$ https://mydomain.com/business-layout/ [R=301,L]


Any Suggestion what is the issue?



OS‪CentOS Linux 7.7.1908 (Core)‬
ProductPlesk Obsidian
Version 18.0.23 Update #4, last updated on Feb 11, 2020 03:41 AM


Thx
Best regards
Sally
 
Thanks for the hint. I tried the adapted snippet in the htaccess File, but the redirect is not working still. I was wondering if
I could wrap your snippet in

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^business-coach-layout/(.*) https://mydomain.com/business-layout/ [R=301,L]
</IfModule>


and add this directly to Apache & Nginx Settings - additional directives http in Plesk ?

Thx
Sally
 
Yes wrapping it in

Code:
<IfModule mod_rewrite.c>

</IfModule>

Makes sense. But if it does not work do you have enabled mod_rewrite ?
Also why not just pasting it into the htaccess in your rootdirectory? This would make it presist, even if you change the server.

Pls also notice: this problem is most probably not related to Plesk itself.
 
Last edited:
i need to redirect from https://[domain.tld]/about to https://[domain.tld]/about-us
and ive added RewriteRule ^about$ /about-us [R=301,L] this code to htaccess file but the redirection is not working why ?
 
Back
Top