I'm running Craft CMS with MAMP at localhost:8888.

When I pass in a URL with {{ entry.title }}, I get http://localhost/news/2016/we-just-installed-craft which gives me a 404 until I manually put in the :8888 after localhost.

Am I missing something in the set up here?

2 Answers 2


I would try and put the port in your siteUrl config param:

'siteUrl' => 'http://localhost:8888',

Alternatively you might be able to use this though haven't tested it (I believe the php server variable uses the server name & port number):

'localhost' => array(
    'siteUrl' => 'http://'.$_SERVER['HTTP_HOST'],
    'devMode' => true,
    'cacheMethod' => 'file'
  • Thanks a lot. Using 'siteUrl' => 'http://'.$_SERVER['HTTP_HOST'] inside my config file fixed the issue for me.
    – Davers
    Commented Oct 7, 2016 at 14:36

Are you required to run port 8888? If not, you can set the port to 80 in MAMP and this would resolve the issue. I know this is not really a fix for your problem but it might be a potential work-around.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.