I am in the process of migrating several websites to a new server. While the data transfer itself is going fine - I am running into issue testing the sites on the new hardware setup. Typically, this is done before any DNS changes are made and can be done by accessing the IP Address directly.
My current issue however lies in how my new server (or perhaps all) is handling pulling css (and other) files while using the PHP $_SERVER['DOCUMENT_ROOT']. The location is correct (using the IP address of course) but for some reason the css files are not loading. When I try to access the css files directly (using IP as the root), I get 403 Forbidden errors.
I also have modified my local windows hosts file to recognize a test address mapping to the sites IP address.
Is this common when trying to use IP addresses? Is there a way around so I can test?
Update
Looking at the error_log, I see several files coming back with the folling error:
client denied by server configuration
followed by the actual file name.
Issue Found (*)
I found the issue was related to my .htaccess file though not quite sure why. It is the same setup I used on my previous server.
AuthType Basic
AuthName "Protected Area"
AuthUserFile /var/www/vhosts/site.com/.htpasswd
Require valid-user
order deny,allow
deny from all
allow from ... (list of different ip addresses)
Satisfy Any
Sounds like you have a permissions error. Make sure the files are owned by the same process as the web server, also you can look at Apache error logs to find out why it is throwing permissions errors.
Probably, your domain name is not default vhost of your webserver so when you try to access with ip address, you get error.
You should add your domain name and ip address of new server to the hosts file of your operating system. Then you can test it with your domain name. All requests from your computer will go new server.