FTP use and point domain to web folder w htaccess

i’m using bedrock but just the composer part because i can’t set up the capistrano part on the server (shared hosting). i’ve installed it locally and everything works as expected. but i’m trying to set up a staging environment on a server and have some questions/issues:

  1. i’ve uploaded my local setup to the server via FTP and edited the .env file with the required info. i know that bedrock focuses on not deploying via FTP as it is not a good practice but i have no other option but to use FTP for this project. does bedrock work like that? what i mean is: is that ok to just upload local bedrock files straight to the server (i didn’t upload the json files and similar. just .env and vendor, config and and web folders)?

  2. i don’t have access to vhost for the server so i added a .htaccess file in the root dir and used it to point the domain to the bedrock web folder like so:

RewriteEngine on RewriteCond %{HTTP_HOST} ^(www.)?example.com$ RewriteCond %{REQUEST_URI} !^/web/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /web/$1 RewriteCond %{HTTP_HOST} ^(www.)?example.com$ RewriteRule ^(/)?$ web/index.php [L]

everything is working now except for one small issue. when i got to staging.mydomain.com/wp/wp-admin i can’t log in to the site. i see the admin screen but when i enter user and password nothing happens. the window just refreshes and stays on the same link. when i got to staging.mydomain.com/wp-admin i can log in with no problem. that kind of thing worries me a bit as maybe it can indicate a bigger issue that i’m currently not aware. so is that a sustainable/ok setup for bedrock to use .htaccess to point to the web folder?

  1. It’s not ideal as you know, but it’s perfectly fine. In the end it doesn’t really matter how the files get on the server, just that they all exist.

  2. If it works then I’m sure it’s sustainable :smile:. I have no idea if there’s some issues lurking as I’ve never tried a setup like that. Just make sure you test a wide variety of things like uploads, plugins, etc and make sure they all work.

thank you for your answer.

i’ll try to test it as best as i can as you suggested. actually the only thing the worries me is the log in issue i mentioned in point 2. it’s that kind of an issue that’s not a big deal and can have no effect and the whole project in the beginning but it can be an indicator of a problem lurking around the corner waiting to pop out… and i just don’t like knowing that something is not behaving as it should :)…

anyway… thnx so much for taking the time to answer my questions.

If you’re using .htaccess like that then you need to give some consideration to security.

At the moment you are only rewriting to the /web folder if a file does not exist; and there are lots of confidential files (including the .env with your mysql user and password) existing in the root.

What you should be able to do is manually change some paths within Bedrock’s application.php and have the settings above the web root, that is assuming you have access above web root on the server:

/home/MyUser/example.com/public_html/ // contents of web folder goes here
/home/MyUser/example.com/private_bedrock/ // bedrock settings go here

sorry if i’m asking dumb questions but this is the server folder structure: /public_html/example.com/. and everything is in that folder. the publc_html folder contains other domains hosted in package. so i don’t think i can set it up like you suggested. because that would mean i would have this folder structure /public_html/example.com/public_html/.

i presume you were referring to that when you wrote:

… that is assuming you have access above web root on the server

meaning that setting it up like that depends on the server setup.

again… sorry if i’m asking dumb questions.

I only used the paths as an example, mostly to make the difference between the web root (public_html) more obvious.

If you can create a folder above the web root (i.e. outside of the public_html folder) then you can put the bedrock settings there, move the contents of web into the public_html folder, and update the application paths as I suggested previously.

/public_html/example.com/ // contents of web folder live here
/private_bedrock/example.com/ // bedrock settings live in this new folder

i got access to the Document Root settings for the domain and was able to point the domain to the /web folder and got everything to work like it’s supposed to with bedrock default settings.
but thank you for your help anyway.