I have a small translation system and works fine. When user clicks on the language the website redirects to /en or /pt.
I also have some custom rules on my htaccess file.
Options -Indexes
RewriteEngine On
RewriteBase /
RewriteRule ^send-email$ send-msg-ajax.php [NC]
RewriteRule ^cv$ docs/cv.pdf [NC]
RewriteRule ^([a-zA-z_-]+)$ index.php?lng=$1 [QSA,L]
#custom error pages
ErrorDocument 403 /error.php
ErrorDocument 404 /error.php
Everything works fine but 403 error appends the parameter lng to the url.
example.local/imgs/?lng=imgs
How can i make this whithout the ?lng=imgs?
thanks in advance!
2
Answers
The correct code is here
Please check this rule
I have added a RewriteCond condition to check if the requested file doesn’t exist
(using %{REQUEST_FILENAME} !-f). This condition ensures that the "lng" parameter won’t be appended to the URL for error documents, such as the 403 error page.