Craft install via composer: install to public_html?

Craft install via composer: install to public_html?



When I do composer create-project craftcms/craft, it will create a web folder. My webroot is called public_html though. Can I change this somehow, or should I make a symlink?


composer create-project craftcms/craft


web


public_html



Or simply don't use composer to install in that case?




1 Answer
1



You can just rename web/ to public_html/, or move all the files inside web/ into public_html/. (Don’t forget to move the .htaccess and .env files, if the latter.)


web/


public_html/


web/


public_html/


.htaccess


.env



As long as the location of the public_html/ folder is in the same place as the web/ folder was, you don’t need to change anything else.


public_html/


web/


my-project.test/
├── config/
├── ...
└── public_html/
├── index.php
└── ...



If you need to change the location to something like this:


my-project.test/
├── craft/
│ ├── config/
│ └── ...
└── public_html/
├── index.php
└── ...



Then just make sure that your CRAFT_BASE_PATH constant points to the right base path (craft/).


CRAFT_BASE_PATH


craft/


// old:
define('CRAFT_BASE_PATH', dirname(__DIR__));

// new:
define('CRAFT_BASE_PATH', dirname(__DIR__) . '/craft');





But won't that break composer update for later maintenance?
– Urs
Aug 23 at 13:48


composer update





No it won't. Composer update installs everything into /vendor. All my projects use /public instead of /web.
– Jay
Aug 23 at 13:50



/vendor


/public


/web





Ok! So that would also be a valid setup: home/craft (with config, modules, storage, template and vendor, not accessible via web), home/public_html (with the content of web and a modified CRAFT_BASE_PATH)?
– Urs
Aug 23 at 13:59


home/craft


config


modules


storage


template


vendor


home/public_html


web


CRAFT_BASE_PATH





In that case just make sure that the CRAFT_BASE_PATH constant in public_html/index.php is pointed at the craft/ folder.
– Brandon Kelly
Aug 23 at 16:08


CRAFT_BASE_PATH


public_html/index.php


craft/





Just updated my answer to show what that would look like.
– Brandon Kelly
Aug 23 at 16:12






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

How do I collapse sections of code in Visual Studio Code for Windows?

ャフサォクコ ケウ,コ,ワ メ,ロスョノ゙,クネ,フムカヤヲニ,エコ゚ツ ウイオン゙ケワサネォキモュキォウイノンコチ゚メヌナイゥフュ,カヒウネェ ネ,ホノケ,ムュキ ッボーミュハ,チ ツス ィ メウイマヤ,゙ウチ ヅ ロ,ォジヌェ ャヌット ェ,マャ,チナエヒネソキツテ トホヲヲミーァ