Errors loading pages on live site, works on local

Hi,

I have a subdirectory for my local Dev site localhost/xy/ and it works fine.
My live site doesn’t have a subdirectory, just http://SITEURL/
When I upload to Live site, it keep looking for the files in the wrong place, it looks for them under the subdirectory “xy” like in the local Dev site.

It’s looking for them in SITEURL/xy/dmxAppConnect but it should be looking for them in SITEURL/dmxAppConnect

Files are all in the correct locations on the live site (check via FTP)
In Project Settings I have “Links Relative to” Document selected.

Can someone kindly assist.
Thank you.

Do you have two targets set up? One for local and one for live? I’m guessing you need the live site set to a different url/directory.

Yes, I have two targets. One for local, which has a subdirectory and one for live, which has no subdirectory and sits at site root.
I’ve attached screenshots of my setting and main project settings.

Is the live server yours? Or is on a hosting platform of some sort?

Live site is on Hosting platform. Would that be a cause? Not sure I follow.

maybe the url to the path is funky or something? Maybe the host sets to a default path. Maybe double check where the files are going via an external FTP client to make sure that they are uploading to where you think they should be? And make sure that the Routing configuration is set as you think it should be?

Also what is the remote directory set to? Can’t see that as is written over?

You can’t develop in a subfolder in the server root like that and upload to the remote server root, the routing won’t work.
Your local and remote fder structures should match.

@Teodor if that’s the case then how can we managed multiple projects on the local dev server? They can’t all be at root level. How do you setup your local dev environment without using subfolders?

if that’s the case then how can we managed multiple projects on the local dev server? They can’t all be at root level. How do you setup your local dev environment without using subfolders?

If you want to use a local subfolder to develop for a remote root folder you can use virtual hosts.
See https://stackoverflow.com/questions/20275044/change-my-hosts-file-to-route-to-a-folder-and-not-an-ip

Here's an example for macos with apache (httpd) installed via brew. If you're using native apache or a pc windows installation the paths for the configuration files will be different, but the changes mostly the same (ie. file path separator for macos and windows differ):

Step 1: Edit the file "/etc/hosts".
Add an entry for the dev site you want to develop for. In this case I want the site "hb.loc" to redirect to my local apache server.
127.0.0.1 hb.loc

Step 2 (only required once): Edit the file "/usr/local/etc/httpd/httpd.conf".
Make sure the include statement for "httpd-vhosts.conf" is not commented out.
# Virtual hosts
Include /usr/local/etc/httpd/extra/httpd-vhosts.conf

Step 3: Edit the file "/usr/local/etc/httpd/extra/httpd-vhosts.conf".
Add an entry for the dev site you added to "hosts" in step 1.
<VirtualHost hb.loc:80>
DocumentRoot "/Users/<yourusername>/Sites/hb/"
ServerName hb.loc
ServerAlias hb.loc
</VirtualHost>
*** Don't forget the ending "/" in the path. ***

Step 4: Restart apache.
brew services restart httpd

You can add as many local dev sites as needed by adding more entries to "hosts" and "httpd-vhosts.conf".
The first time you view your local site you may have to specify the full site name ("http://hb.loc") if you used any unknown domain name like the ".loc" in the example.

1 Like