Go Back   MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 1, 2013, 10:22 PM   #1
Ships
macrumors newbie
 
Join Date: Jan 2013
Troubleshooting advice - paths not resolving when viewing site locally

Ive been around the block with this problem so many times I'm not even sure where to start! Done a lot of searching, spent days on it really. Perhaps someone may have an idea of how best I should attack the issue.

I have a functioning live web site that i have helped put together ( www.chrisdonaldson .com.au/). My initial involvement was limited to css (.less) tweaks and adding all content, but the bulk of the backend-development was done by someone else, who I can't get help from anymore.
Up until the end of September I had been able to make any adjustments, and view the site locally with no problems at all. Now, I need to make some more updates, and something has changed (and I can not work out what).
For some reason the paths aren't resolving correctly. That goes for css, js & images.
The site has an index.php file which appears to bring in a head.html and an index.html - but I don't know anything about php.

The crux of the issue is, that everything was working fine before - ie, I could view the site locally, and all paths resolved correctly, but now when I try and view it, I get plain html without any js or css.

Now I realise I'm supposed to have apache up and running for php - and so I have turned web sharing on, and also tried to go through all the steps to get php going following a tutorial on Lynda .com. But why would this all have worked before without even me thinking about web sharing....and now it doesn't? Something's not adding up.

I cannot for the life of me think why the paths (which as far as I can tell are all relative, and should work same whether up live or on my machine) aren't working. I did notice that some of the paths to images were a little sloppy, so, in my testing Ive tweaked those, and hey presto, I can at least get images to display locally. But the paths look correct for the css and the js, and well, I am just stumped.
Is it possibly a localhost problem with php on my system? Are there ways I can systematically go through some steps that may be at issue here?

Truly, any advice would much appreciated.

MAC OS 10.6.8 (I also have another site that works fine locally, but it doesn't use any php.)

Last edited by Ships; Jan 1, 2013 at 10:25 PM. Reason: typos
Ships is offline   0 Reply With Quote
Old Jan 2, 2013, 08:13 AM   #2
AFPoster
macrumors 65816
 
Join Date: Jul 2008
Location: Charlotte, NC
Before when it worked did you have complete access to the servers files via FTP or through your text editor? This might be why you were able to see your changes right away. This is also the best way to make changes if you don't have an admin panel. Me personal below is what I suggest:

Because the files are .php you need to setup a personal web server on your computer. I personally use MAMP (http://www.mamp.info/en/index.html) download the regular version. Once installed click on "Preferences" select the Ports tab and change the Apache Port to 80, click save and that's it.

You need to move your site files to the htdocs folder inside of the MAMP folder. This is where "localhost" is linking to on your browser. So make all changes needed and then copy and paste all files and folders to upload to the server.

To access the site so that it's viewed with jquery, javascript, css, etc open a browser and type "localhost" and it will display your site. Make changes using any editor you'd like and they will show on the browser as you refresh.

This might seem like a lot but I learned all this from a 2 min video and it's pretty basic. YouTube has a ton of initial setup videos on their site and trust me this will save you a lot of time!
__________________
2014 15" Retina MacBook Pro 2.5Ghz i7
iPad 2 32gb (white)
iPhone 6+ 64gb (white)
iPhone 5s 16gb
AFPoster is offline   0 Reply With Quote
Old Jan 22, 2013, 12:12 AM   #3
Ships
Thread Starter
macrumors newbie
 
Join Date: Jan 2013
Quote:
Originally Posted by AFPoster View Post
Before when it worked did you have complete access to the servers files via FTP or through your text editor? This might be why you were able to see your changes right away. This is also the best way to make changes if you don't have an admin panel. Me personal below is what I suggest:

Because the files are .php you need to setup a personal web server on your computer. I personally use MAMP (http://www.mamp.info/en/index.html) download the regular version. Once installed click on "Preferences" select the Ports tab and change the Apache Port to 80, click save and that's it.

You need to move your site files to the htdocs folder inside of the MAMP folder. This is where "localhost" is linking to on your browser. So make all changes needed and then copy and paste all files and folders to upload to the server.

To access the site so that it's viewed with jquery, javascript, css, etc open a browser and type "localhost" and it will display your site. Make changes using any editor you'd like and they will show on the browser as you refresh.

This might seem like a lot but I learned all this from a 2 min video and it's pretty basic. YouTube has a ton of initial setup videos on their site and trust me this will save you a lot of time!
Sorry for the late reply, and thankyou for your response! You pretty much nailed it, AFPoster.

Though it didn't work straight away after setting up MAMP - I basically needed to set up a virtual host, and this did the trick. The tute i followed was at http://foundationphp.com/tutorials/vhosts_mamp.php there was no need for terminal, and was fairly easy to follow for a pleb like me.

Basically I added a virtual-host to the hosts file (Macintosh HD: private:etc:hosts)
Then uncommented the line under 'Virtual hosts' #Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf in the httpd.conf file.
And then, rather than editing the Applications:MAMP:con:apache:httpd.conf file, (as indicated by steps 6 onwards in this tute), I made these additions:

Code:
<VirtualHost *:80> ** DocumentRoot "/Applications/MAMP/htdocs" ** ServerName localhost </VirtualHost>
<VirtualHost *:80> ** DocumentRoot "/Users/username/Sites/mysitename" ** ServerName mysitename </VirtualHost>
to the /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf file.

Anyway, basically now all paths resolve correctly, and I can set up new web roots for new jobs.
Ships is offline   0 Reply With Quote
Old Jan 22, 2013, 08:56 AM   #4
AFPoster
macrumors 65816
 
Join Date: Jul 2008
Location: Charlotte, NC
Quote:
Originally Posted by Ships View Post
Sorry for the late reply, and thankyou for your response! You pretty much nailed it, AFPoster.

Though it didn't work straight away after setting up MAMP - I basically needed to set up a virtual host, and this did the trick. The tute i followed was at http://foundationphp.com/tutorials/vhosts_mamp.php there was no need for terminal, and was fairly easy to follow for a pleb like me.

Basically I added a virtual-host to the hosts file (Macintosh HD: private:etc:hosts)
Then uncommented the line under 'Virtual hosts' #Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf in the httpd.conf file.
And then, rather than editing the Applications:MAMP:con:apache:httpd.conf file, (as indicated by steps 6 onwards in this tute), I made these additions:

Code:
<VirtualHost *:80> ** DocumentRoot "/Applications/MAMP/htdocs" ** ServerName localhost </VirtualHost>
<VirtualHost *:80> ** DocumentRoot "/Users/username/Sites/mysitename" ** ServerName mysitename </VirtualHost>
to the /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf file.

Anyway, basically now all paths resolve correctly, and I can set up new web roots for new jobs.
Glad to hear it and I apologize for the lack of detail on my end. One thing to keep in mind is that if you have a form script it will not work during testing, at least for me it does not, but on my server it does, just as an fyi.
__________________
2014 15" Retina MacBook Pro 2.5Ghz i7
iPad 2 32gb (white)
iPhone 6+ 64gb (white)
iPhone 5s 16gb
AFPoster is offline   0 Reply With Quote
Old Jan 23, 2013, 09:27 PM   #5
Ships
Thread Starter
macrumors newbie
 
Join Date: Jan 2013
OK cheers AFPoster, thanks for the heads-up!
Ships is offline   0 Reply With Quote

Reply
MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Resolving Advertisement Links PreetinderBajwa OS X 0 Dec 27, 2013 10:34 AM
Slow Ethernet Ip resolving AndersVirring OS X Mavericks (10.9) 0 Dec 18, 2013 04:54 AM
Troubleshooting advice needed, A1181 inverter replaced now no video or boot tones WildCard^ MacBook 1 Nov 5, 2013 09:33 AM
How to Access Same Website Locally and Non-locally? fastpurplemedia Web Design and Development 3 May 30, 2013 09:10 PM
Looking for advice: Storing and retrieving data locally within an iPhone app DDustiNN iPhone/iPad Programming 9 Oct 2, 2012 08:16 PM

Forum Jump

All times are GMT -5. The time now is 07:53 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC