amber wrote:What I did was that I just "copied/download/transferred" (whatever the right term is) via FTP the entire "public http" folder from my Host cpanel (in which I named "SITE" folder in my computer), and then I put a copy of this "SITE" folder into the XAMPP htdocs folder. I didn't amend or edit anything from the folder.
In light of what you wrote above then I believe your issues are with relative paths in your file's html or php code.
For example (
public_http and public_html are the same for this example):
/somefile.php on your online hosted server would be found in public_html/somefile.php
/somefile.php on XAMPP server would be found in htdocs/somefile.php
So in your case all the relative paths that point to /somefile.php need to be changed to simply somefile.php that reside in the htdocs/site folder - drop the leading slash.
In XAMPP the DocumentRoot is htdocs
Your files are in htdocs/site
So the relative path for your files in htdocs/site/ would be simply somefile.php or somefolder/somefile.php
http://localhost/site/somefile.php
http://localhost/site/somefolder/somefile.php
Clear as mud but you need to adjust your paths to take into account your move to htdocs/site/somefile.php in XAMPP, as in your online server they are in public_html/somefile.php
Your XAMPP server is looking for /somefile.php in the htdocs folder - htdocs/somefile.php - so you will always get the 404 'file not found' error until you fix the paths and the Apache server's error.log file will confirm this - put simply...
public_html/somefile.php = http://yourwebsite.com/somefile.php
htdocs/somefile.php = http://localhost/somefile.php
You can create an exact mirror of your online site by simply downloading all the files from your public_html folder and putting then in the htdocs folder of XAMPP.
(
Delete the 2 index files already in there - index.php and index.html - which are not needed for this exercise to work, you will be using your own site's index files).
Then your relative paths and your web site will work in XAMPP with hopefully no more 404 'file not found' errors in your browser or in the error.log file.
Or you can create an exact mirror of your online hosted web site by creating a VirtualHost in XAMPP - searching as much as possible and reading about this subject will be worth the effort - too much detail for me to include in this topic.
So in summary I have given you 3 methods to fix your relative path issues:
1. Correct all the relative paths to reflect the site's files are now using the htdocs/site folder
2. Move the files out of the htdocs/site folder and into the htdocs folder.
3. Create a VirtualHost.
BTW the log files are always stored in
"C:\xampp\apache\logs\" folder by defaults and you need to drag them into your text editor to read them or associate the
.log file extension with your text editor to allow you to double click on the log files to open in your text editor.
Good luck and if you know how, then you can use your text editor to find and replace your errant relative paths or change them all to absolute paths - Google for help on these path references if your not familiar with the terminology.