• The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Can't setup rewriterule on

labulle

New Pleskian
I need help... I wan't to redirect a distinct domain to a subfolder of a webspace with it's own domain name.

My rewrite rules was working on previous plesk 10.0. I tru 2 methods :
A) I've tried to add rewrite rules to additional httpd directive in apache & nginx settings of the webspace test.domain.tld but I got to the right php file but the file is downloaded. I've tried to disable fastcgi support or to add httpd directive to setup php but no changes.

B) I've added theses rules to a .htaccess file on inside webspace httpdocs. But it seems to be ignored because main webspace is loaded without subfolder. FollowSystemLink is not disabled.

The rewrite rules are :
ServerAlias demo.domain.tld
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?demo\.domain\.tld$ [NC]
RewriteRule !^subdir/ /subfolder/%{REQUEST_URI} [L,NC]

I also tried to remove Server Alias but that changes nothing. I guess because the domain is attached towebspace in plesk panel.

My config is :
OS: ‪Ubuntu 14.04.3 LTS‬
Plesk version: 12.5.30 Update #13
 
Last edited:
Hi labulle,

first of all, please note, that apache rewrite rules don't work for nginx. They have to be converted into nginx directives. A nice tool for such a process is the

htaccess to nginx - converter

which you can install over the extension catalogue.


Please inspect your current domain specific configuration files at "/var/www/vhosts/system/demo.domain.com/conf/" and be aware, that "test.domain.com" is not the same as "demo.domain.com".

Use the Plesk Control Panel, to change the document root for a (sub)domain. This is far easier, than using rewrites.



If PHP - files are offered to be downloaded instead of being displayed, the PHP - handler is misconfigured, or absent. You could try the command:

/usr/local/psa/admin/sbin/httpdmng --reconfigure-all

... over your command line, to reconfigure the depending configuration files and you could as well try to switch your PHP - handler over the Plesk Control Panel at:

Home > Subscriptions > YOUR_DOMAIN.COM > Websites & Domains > PHP Settings



Last, please note that errors from log - files mostly point directly to an issue and if you provide such log - entries, it is far easier to investigate your issue.

/var/www/vhosts/system/demo.domain.com/logs

In addition, you should inform us, about your apache - version and if you need help with investigations, it is always a good idea to post the depending configuration files from "/var/www/vhosts/system/demo.domain.com/conf/"

 
Thanks a lot for your complete answer I was desperate.
By the way I wrote test.domain.tld and not demo.domain.tld in my message I should wrote that my webspace is on test.maindomain.tld and rewriterule with demo.otherdomain.tld to avoid confusion/
That's why can't use the subdomain tutorial because the domain I wan't to redirect to a subfolder is not a subdomain.

I've added nginx rewriterules with your great tool but that didn't help, file is still downladed..
I've also tried /usr/local/psa/admin/sbin/httpdmng --reconfigure-all
In both cases I had again :
[Thu Dec 03 15:37:15.490323 2015] [proxy_fcgi:error] [pid 31837:tid 140684866610944] [client 91.240.109.89:33768] AH01071: Got error 'Primary script unknown\n'

So I tried to change PHP handler that was "FastCGI application served by Apache" to "FastCGI application served by Apache" and that worked php file is loaded and not downloaded.. (Changing it to "FPM application served by nginx" gives a downloaded file again).
So great that is working with that handler but I read here : http://docs.plesk.com/en-US/12.5/ad...sting/php-management/php-handler-types.75145/ that this handler use a lot of memory..

Do you have a idea about this "Primary script unknown" ? I really don't understand why rewrite rules makes the default handler to ignore php file after a subfolder redirection !

Regards,
 
Back
Top