Correct htaccess setting for subfolder wordpress?

how to config correct htaccess setting for subfolder wordpress install?

I am using domain on shared hosting account that has passenger turned on (for later django setup).
i want to just install now wordpress, which automatically installs in user/public folder.

Wordpress seems to install into user/public fine
however generated one time login link fails.
as i dont think its directing into the public folder.
(even if i add the public into the url for the one time link it doesnt work).

wordpress installs work fine on other domains on same account.

i tried to config htaccess in user dir as per:

but it didnt work.

This tool seems to suggest redirect should be fine though:
https://htaccess.madewithlove.be
giving output url https://mywebsite.com/public/

i removed the wordpress directives from the htaccess at user level

(1) do i delete the htaccces inside user/public ?

anyway i tried both, leaving and disabling (commenting out all lines) in the default htaccess.
as i understand, the one in user applies to all directories under anyhow.

<IfModule mod_rewrite.c>

# below is original settings
#RewriteEngine On
#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
#RewriteBase /
#RewriteRule ^index\.php$ - [L]
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule . /index.php [L]

RewriteEngine on
#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# below follows wordpress example: # https://wordpress.org/support/article/giving-wordpress-its-own-directory/
# Rewrites all URLS [Replace "example" with the actual domain, without the TLD (.com, .net, .biz, etc)]
#RewriteCond %{HTTP_HOST} ^(www.)?mywebsite.com$
# Rewrites all URLS without public in them
#RewriteCond %{REQUEST_URI} !^/public/
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all those to insert /folder
#RewriteRule ^(.*)$ /public/$1
#RewriteCond %{HTTP_HOST} ^(www.)?mywebsite.com$
#RewriteRule ^(/)?$ public/index.php [L] 

# https://stackoverflow.com/questions/41724908/wordpress-rewrite-in-subdirectory-not-working#41725238
#RewriteRule ^public/(.*)$ /$1 [L,R=301]

# below is as per Dreamhost docs: 
# This example redirects all requests for a website automatically to a subdirectory named /blog. 
# Rewrites all URLS without blog in them
RewriteCond %{REQUEST_URI} !^/public/

# Rewrites all URLS [Replace "example" with the actual domain, without the TLD (.com, .net, .biz, etc)]
RewriteCond %{HTTP_HOST} ^(www\.)?mywebsite\.

# Rewrite all those to insert /folder
RewriteRule ^(.*)$ /public/$1 [L]


# to force https. 
#https://help.dreamhost.com/hc/en-us/articles/215747758-Force-your-site-to-load-securely-with-an-htaccess-file
#RewriteRule ^(.*)$ https://www.mywebsite.com/$1 [R=301,L,NE]

PassengerFriendlyErrorPages on

</IfModule>

Unless you have a very specific reason that requires a WP installation (or any other non-static data/app) to reside within a Passenger-spawned directory structure then I’d strongly suggest splitting them between the main domain and a subdomain. You can use the same user to set up a subdomain in order to keep everything “under one login” for SFTP/shell/script access.

ok thanks. i was thinking to do this as well. anyhow its possible the settings hadnt propagated yet, cos now wordpress seeems to be accessible on the domain (unless a fairy fixed it for me?). i was under the imrpression that htaccess didnt require time to propagate and worked immediately. so it seems resolved for now. yes, i will consider the subdomain more closely too. thanks.

edit. just noticed it prompts me that enabling passenger again when creating the subdomain will delete everything in public. so i guess i need to move the wordpress installation to another folder.

.htaccess rules are applied instantly. It might be that having Passenger enabled at the outset made things appear to not operate as they should.

You can access php files in the /public directory of a Passanger-spawned structure by omitting “public” in the URL path and also including .php on the target (eg. index file).

Example:

xnode.dreamhosters.com/app.js
xnode.dreamhosters.com/index.php/public/index.php

I also want to know this and I am glad I have found your post.