1

I've looked everywhere and can't find a solution to my issue. I'm in the process of setting up a local Craft 3 site and have a question regarding the URL setup. When I originally installed Craft I did a manual install (downloaded Craft 3 from the Craft site) and used terminal and MAMP and used the manual MAMP default ports (which was the direction in the video tutorial I watched). I did not install using Composer for I was having issues. I'm on a Mac.

I edited my .env file to the settings below after creating my database in phpMyAdmin to the settings I entered:

# Database Configuration
DB_DRIVER=mysql
DB_SERVER=127.0.0.1
DB_PORT=8889
DB_DATABASE=craftdatabase
DB_USER=craftuser
DB_PASSWORD=Sundancer290
DB_SCHEMA=
DB_TABLE_PREFIX=

# The URI segment that tells Craft to load the control panel
CP_TRIGGER=admin

PRIMARY_SITE_URL=http://localhost:8888/

My base URL setting in Craft under settings/sites is $PRIMARY_SITE_URL.

When I click the visit webpage icon inside entries I get the following in the URL: http://localhost:8888/http:/localhost:8888/http:/localhost:8888/about/locations/austin-tx

How can I change this to https://craftsite.test/about/locations/austin-tx like a normal URL? Where would I go to change these settings? MAMP and my .env file? I'm at a loss trying to figure this out for a few days now.

Thanks for any help!

enter image description here

1 Answer 1

2

You need to edit the Entry URL Format under Settings > Sections > [choose section]. If you want your URLs to mirror the Structure's hierarchy then set it to something like {parent.uri}/{slug}.

However! It looks to me like you're falling into the trap of mirroring the current design/layout of your front end site into your content model. I've inherited lots of sites built like this and they become practically impossible to redesign/realign, instead requiring full rebuilds, and they're just horrible to work with once the content model grows.

Instead, consider creating a separate section called "Locations" where each entry represents a single location, and then use relationships to tie everything together.

More comprehensive rant about arbitrary hierarchical abuse available at https://cld.agency/blog/content-utopia!

In short, I'd argue that semantically/taxonomically speaking, a child item in a hierarchy should always be a more specific type of its parent, but still the same "thing". "Austin TX" is not the same "thing" as the "Locations" entry, nor the "About" entry. I would imagine that the former should be a listing page showing all locations, while the latter should be a generic information page that gathers together whichever content the editor chooses.

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.