URL重写(内部/外部转发器).htaccess

I am using .htaccess for URL Rewriting. My current .htaccess code is:

RewriteEngine On
RewriteBase /

# external redirect from actual URL to pretty one
RewriteCond %{THE_REQUEST} \s/+fr/transporter/transporterPublicProfile\.php\?profil=([^\s&]+) [NC]
RewriteRule ^ fr/profil-des-transporteurs/%1? [R=302,L,NE]

# internal forward from pretty URL to actual one
RewriteRule ^fr/profil-des-transporteurs/([^/.]+)/?$ fr/transporter/transporterPublicProfile.php?profil=$1 [L,QSA,NC]

My URL is :

https://example.com/fr/profil-des-transporteurs/1927

It works fine when I place .htaccess file in DOCUMENT_ROOT directory.

But it doesnot work when I put same .htaccess file in real sub-directory i.e /fr/.

So what should I do, if I want to place .htaccess file in sub-directory i.e /fr/

Use these rules inside /fr/.htaccess:

RewriteEngine On
RewriteBase /fr/

# external redirect from actual URL to pretty one
RewriteCond %{THE_REQUEST} /fr/transporter/transporterPublicProfile\.php\?profil=([^\s&]+) [NC]
RewriteRule ^ profil-des-transporteurs/%1? [R=302,L,NE]

# internal forward from pretty URL to actual one
RewriteRule ^profil-des-transporteurs/([^/.]+)/?$ transporter/transporterPublicProfile.php?profil=$1 [L,QSA,NC]

Try this

RewriteEngine On
RewriteBase /fr