SOLVED PHP files not being served from an aliased directory

SteveKUK

Registered
Aug 27, 2021
2
0
1
Bath, UK
cPanel Access Level
Website Owner
I have a brief to merge two php based websites into one - where the second site is to be served in a sub-folder of the main domain rather than a subdomain.

I have set up an alias to point a particular folder to the second website.

Alias "/distribution" /path/to/second/webroot/folder/

This is working fine for .html files, but any request for a .php file in this aliased folder redirects to the main website's top level domain. Even if that php file only contains an exit('test');

e.g. a request for https://domain.com/distribution/test.html serves that HTML file.
BUT
a request for https://domain.com/distribution/test.php redirects to domain.com without touching the file.

The same alias method works fine on my local apache / php set-up.

Any ideas how to get the php files to run correctly in this scenario?
 
Last edited by a moderator:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
7,442
1,004
313
cPanel Access Level
Root Administrator
Hey there! That's definitely odd, and not something I would expect to happen in normal circumstances. Do you see anything odd in the Apache error log file (/etc/apache2/logs/error_log) when you try and access the test.php page? Do you have anything in the .htaccess file that could be routing PHP pages differently?
 
  • Like
Reactions: SteveKUK

SteveKUK

Registered
Aug 27, 2021
2
0
1
Bath, UK
cPanel Access Level
Website Owner
Thank you @cPRex it was a permissions issue I'd checked the project out of git and not noticed it'd gained group writeable permissions. The nudge to look in the server wide error log signalled the issue.