PDA

View Full Version : PHP5 on subdomains


raezr
12-18-2006, 10:04 PM
I recently set up a subdomain and I need to activate PHP5 to use simplexml functions. So I entered this in my .htaccess:RewriteEngine On
RewriteCond %{HTTP_HOST} !(www\.)?php\.
RewriteCond %{SCRIPT_FILENAME} \.php$ [OR]
RewriteCond %{SCRIPT_FILENAME} /$
RewriteCond %{SERVER_NAME} (www\.)?(.+)
RewriteRule ^(.*)$ http://www.php.%2:9000/$1 [P,L]

However, when I try to view the subdomain it will redirect me from "http://subdomain.domain.net/" to "https://www.php.subdomain.domain.net:19638/webhost/rollout/site" which asks me to log into my admin panel. And if I try to access any files on the subdomain it returns a 404 message. This same .htaccess code works fine on my normal domain, so I'm not sure what to do.

Matt
12-19-2006, 01:28 AM
Is this a virtual ("Add Subdomain") or concrete ("Add User") subdomain in esprit? You can either make a symlink under /var/www/html/ pointing to the subdomain's document root and use that in the rewrite rule. Otherwise in order to make it all work, I'll need to make some fixes to your domain's Apache configuration (which will be finalized in the fourth generation). Drop me a PM with your domain and subdomain that you'd like to enable PHP5 for.

MarmaladeMan
12-24-2006, 09:03 PM
I had this same problem here (http://forums.apisnetworks.com/showthread.php?t=190) but I managed to fix it.

For what it's worth (I know nothing about mod_rewrite but this might fix it), I think you need to change your RewriteRule line and add the path that the subdomain points to.

So this:

RewriteRule ^(.*)$ http://www.php.%2:9000/$1 [P,L]

Needs to change to this:

RewriteRule ^(.*)$ http://www.php.%2:9000/<subdomain_path>/$1 [P,L]

Good luck!

raezr
12-26-2006, 05:56 PM
I PMed Matt and it looks like he fixed it. I'm terrible at mod rewrites, so thanks for the help. :)

David Ginger
12-28-2006, 02:02 PM
Hoping this problem will go away with the migration to a new server.

Matt
12-28-2006, 11:49 PM
Yup, already fixed in the next generation and the www.php component of the host is gone too. The only caveat to it is that instead of checking on www.php to see if you're running the script on the PHP5 server, you'd check the port, i.e. RewriteCond %{SERVER_PORT} !9000