When accessing from ######1.co.uk (which has an SSL) to document root ###/production everything works fine.

However when accessing ###/production from ######2.co.uk (which doesn't have an SSL - set up in the vhost file) the home page displays fine but the other pages are returning a 404.

Here's the entry in the vhost file that points #####2.co.uk to ###/production

<VirtualHost *:80>

DocumentRoot "/var/www/html/####/production"
ServerName #####2.co.uk
ErrorLog "/etc/httpd/logs/####.error.log"
CustomLog "/etc/httpd/logs/####.log" common

<Directory /var/www/html/####/preprod>

        AuthType Basic
        AuthName "Authentication Required"
        AuthUserFile "/var/www/html/secure/.htpasswd"
        Require valid-user

        order allow,deny
        allow from all
        AllowOverride all

</Directory>

<Location /api/sms>
        AuthType Basic
        AuthName "Authentication Required"
        AuthUserFile "/var/www/html/secure/.htpasswd"
        Require valid-user
</Location>

</VirtualHost>
Done a quick google search and this could be down to the .htaccess file in ###/production

Options +FollowSymLinks
Options -Indexes

RewriteEngine On

RewriteBase /

RewriteCond %{HTTP_HOST} !^www.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

Old website redirects

RewriteRule ^(.+).aspx$ http://%{SERVER_NAME}/$1/ [QSA,NC,R=301,L]
RewriteRule default/?$ http://%{SERVER_NAME}/home/ [NC,R=301,L]

SSL Redirects

RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_URI} ^/(.)
RewriteRule ^(.
)$ https://%{SERVER_NAME}/$1 [L]

Codigniter Page Handling

RewriteCond $1 !^(index.php|content|assets|files|flash|uploads|xml|private/uploads|robots.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
Any ideas as to what the problem is?

Also note that the Directory of #####2.co.uk is set to

<Directory /var/www/html/####/preprod>
Which is different to the Document Root.

DocumentRoot "/var/www/html/####/production"

Check your directory and file permissions. This is the most likely problem - incorrect permissions on sub-directories or for file access.

So sorry for not seeing this sooner, but it could also be this part of the config.php file:

/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string.  The default setting of 'REQUEST_URI' works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'REQUEST_URI'    Uses $_SERVER['REQUEST_URI']
| 'QUERY_STRING'   Uses $_SERVER['QUERY_STRING']
| 'PATH_INFO'      Uses $_SERVER['PATH_INFO']
|
| WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
*/
$config['uri_protocol'] = 'REQUEST_URI';

Were you ever able to get it figured out?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.