I want redirect augias.eu to subdirectory augias.eu/fr. Redirection is working fine but all the urls like augias.eu/fr/path are redirected to augias.eu/fr I don't get it. The website is live.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^augias.eu [NC,OR]
RewriteCond %{HTTP_HOST} ^www.augias.eu [NC]
RewriteRule ^(.*)$ https://augias.eu/fr/$1 [L,R=301,NC]
# BEGIN WordPress
<IfModule mod_rewrite.c>
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]
</IfModule>
# END WordPress
HTacces file of the /fr directory
# BEGIN WordPress
<IfModule mod_rewrite.c>
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]
</IfModule>
# END WordPress
CodePudding user response:
In the main directory .htaccess file change this RewriteRule:
RewriteRule ^(.*)$ https://augias.eu/fr/ [L,R=301,NC]
to this one:
RewriteRule ^(.*)$ https://augias.eu/fr/$1 [L,R=301,NC]
because $1
represents the first value enclosed in ()
. In this case match this expression (.*)
.
And inside the /fr/ folder, edit or create a new .htaccess file with this content:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /fr/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /fr/index.php [L]
</IfModule>
# END WordPress