404当WordPress在子文件夹中时

I know this question often comes up but none of the answers is satisfactory for me. I tried everything I could find on the web nothing works.

1 - I installed my Wordpress in a sub folder /folder/wp.

2 - I moved .htaccess and index.php to the root ( given by WordPress )

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /folder/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /folder/index.php [L]
</IfModule>
# END WordPress

3 - I changed index.php like this:

/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp/wp-blog-header.php' );

4 - I changed WordPress url: http://localhost/folder/wp

5 - I kept site url: http://localhost/folder

Without Permalinks, everything works. As soon as I turn on permalinks, I have a 404

There are some things I do not understand:

1 - Why keep index.php and .htaccess in the sub folder?

2 - Some say to add /wp in RewriteBase and RewriteRule in .htaccess at the root, but it does not change?

I read dozens of Post and nothing works for me. Has anyone ever faced this problem?

thank you very much

Something that is not thought is to ensure that the Apache mod_rewrite module is enabled. There are dozens of tutorials on Wordpress installation in a sub folder but none specifies that. I hope this can help.