I have a fresh installation of Apache/2.4.7 (Ubuntu), running a LAMP stack. I've transferred all my files to the new server and I'm getting the following error when trying to access a subdomain, the actual domain works fine:
Forbidden You don't have permission to access /index.php on this server.
I've done quite a bit of searching and this thread seems to have the most solutions (most of which I've tried).
Here is my apache2.conf file:
<Directory />
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
What's strange is the sub-domain is just basically a mask through .htaccess, therefore the website content never leaves /var/www/example_com - my permissions on 'www' is 755, and I have full root access.
I'm quite confused as I can't seem to find anything to work that would allow me to access a subdomain of my main domain: sub.example.com - just gives me 403.
Any help is greatly appreciated.
Edit (more information on my .htaccess file) The permissions on my .htaccess file are 755, and it's not changed in months. It worked on the previous server which ran the same LAMP stack but was just an older version of Ubuntu.
RewriteEngine on
RewriteCond $1 !^(index\.php|images|js|profile_pictures|fonts|stylesheets|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
RewriteCond %{HTTP_HOST} !^((www\.)?)example\.com [NC]
RewriteCond %{HTTP_HOST} ^(.*)\.example\.com
RewriteRule ^(.*)$ http://example.com/site/%1$1 [L,NC,P]
RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
Just to note, I'm also running CodeIgniter (if that matters).
Here is my loaded PHP modules (I'm thinking somewhere in here is the problem):
core mod_so mod_watchdog http_core mod_log_config mod_logio mod_version mod_unixd mod_access_compat mod_alias mod_auth_basic mod_authn_core mod_authn_file mod_authz_core mod_authz_host mod_authz_user mod_autoindex mod_deflate mod_dir mod_env mod_filter mod_mime prefork mod_negotiation mod_php5 mod_rewrite mod_setenvif mod_status