Plesk for Linux
kb: how-to
Applicable to:
- Plesk for Linux
Question
How to keep .htaccess rules after switching PHP handler from Apache to nginx?
Answer
Prior to switching to nginx:
- Log in to Plesk as admin user
- Install htaccess-to-nginx converter extension: How to install Plesk extension
- Go to Domains > example.com > Apache & nginx Settings > Additional nginx directives and click a link as below:
- Insert the content of
.htaccess
file and press Convert to nginx button - Click OK to save the changes
Note: a featue request to automate htaccess to nginx directives conversion is available here. Feel free to vote for it to be implemented in future Plesk releases.
Comments
3 comments
your extension converter chokes on htaccess to nginx conversion for 404
# Custom error docs
ErrorDocument 404 /404-page-not-found.htm
Can you respond with the nginx directive for 404?
can you guys provide a shortlist of top 10 nginx directives that work on Plesk?
cache
404, 301
extensionless htm, html, php
rewrite domain.index to domain only
#Header append Cache-Control "public"
# ExpiresActive Off
# Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
# Header set Pragma "no-cache"
# Enable ETags
FileETag MTime Size
Nginx directives
Version 18.0.33 Update #1, last updated on Feb 26, 2021 03:12 AM
the convert button doesn't appear at all.
@Xynet please reinstall the extension, the issue has been recently fixed in the new version
Please sign in to leave a comment.