Formatting broken on localhost when set as Relative to DOCROOT

My site was initially set up as relative to Page and I was able to view sites on the localhost using MAMP but after changing to relative to DOCROOT the formatting automatically appeared broken on the localhost. It was fine in preview and fine on the actual server.

I thought this was a bug in MAMP, so last night I tried AMPPS and found exactly the same issue. I contacted their support forum to ask if there was a fix and they seem to think it’s a bug in Rapidweaver.

Is there a solution here?

They seem to think it’s a bug in RapidWeaver

Could you elaborate on why that is suggested, at all? I’d guess that if /rw_common isn’t processed by Safari / MAMP correctly, it’s looking for things at the root of your Mac instead of at the root of the export folder. RW doesn’t handle this - the easiest way to see if this is the case would be to use the Web Inspector to see why the assets aren’t loading. If the paths are correct, have you definitely exported the full site?

—Nik

They simply said “It seems that this is RapidWeaver related issue. Please let us know if you need any further information.”

I am seeing this in all web browsers and not just Safari. Yes the full site has definitely been exported. Looking at the formatting here I did wonder if this may be related to SSL. It’s the same problem whether I use MAMP or AMPPS and it goes away if I set RW as relative to Page. I have verified this with more than one RW site.

I mention Safari simply as an example - maybe you could post a screenshot with the Web Inspector open so we can take a look at the errors in it? (Open the Inspector, click on a warning, take screenshot).

OK here it is:

Sorry, I meant “Errors” - I’ll check back once I’ve made a coffee :wink:

Actually I realised I’d messed up the moment I posted it :grinning:

It mentions the 403 error to typography.com but I was seeing this issue long before using them and I think I’ll be removing their fonts because they are slow loading.

So looking at those URLs, it looks as though you’ve set up the MAMP server for the folder that contains the CMP_Foundation folder, not the sub-folder itself. If you point MAMP at the correct folder (so that http://localhost:8888/ itself loads the contents of CMP_Foundation) you should be all set.

OK I see what is happening now. I have a folder on Dropbox called Exported that contains 3 or 4 site project folders. Once I navigate to the http://localhost:8888 I can then open the folders and view the sites normally when links are set as relative to Page. When set as relative to DOCROOT they break. Putting the site contents back in the main directory fixes it. Does that sound like correct behaviour from RW?

Hi Ashley,

Apologies if I’m being unclear: there is no “behaviour from RW” here. The only behaviour that is affecting this is due to your MAMP configuration not being correct. You’re asking the site to use DOCROOT-based URLs, which RapidWeaver generates correctly. Once RW has exported (again, correctly) you’ve chosen to locate the site in a place other than DOCROOT. So of course it’ll display wrongly :wink: You’d need to point MAMP to the folder for the site so that MAMP can correctly set up the web server and ensure that DOCROOT is applied correctly.

Thanks,

—N

Sure I get it now. I found it rather convenient previously being able to access a main Export folder and then select any given project as it allowed me to keep everything tidily in one place with no hassles. That is not possible when using relative to DOCROOT. I would have to change the preferred folder in MAMP preferences every time I want to view a site or never have more than one project in the Export folder.

IIRC, MAMP Pro allows you to create multiple hosts. So perhaps http://cmpfoundation:8888 for that folder, etc etc. We’ve used it this way in the past, for both the RMS site and things like the Community. It’s really useful.

OK good to know. I’ve just been using the free version up to now. Perhaps AMPPS also allows this as well but I’ll have to investigate.