Answer the question
In order to leave comments, you need to log in
How to fix url via htaccess?
Good afternoon, respected masters of their craft. I need help setting up the htaccess file.
Given.
Link https://sitename.ru/docs.php?lang=en
Need to get it.
Link https://sitename.ru/docs.php
Any page that has ?lang=en in the address bar is replaced (or redirected) to the same string, but without ?lang=en
Current file:
RewriteEngine On
RewriteCond %{ HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
RewriteCond %{HTTP_HOST} ^www.sitename.ru$ [NC]
RewriteRule ^(.*)$ https://sitename.ru/$1 [R=301,L]
RewriteCond %{REQUEST_URI} ^(.*)/index.php$
RewriteRule ^(.*)$ %1/ [R=301,L]
RewriteRule ^index\.php$ https://sitename.ru/ [L,R=301]
ErrorDocument 404 https://sitename.ru/404 .php
Answer the question
In order to leave comments, you need to log in
RewriteCond %{QUERY_STRING} (^|&)lang\=en($|&)
RewriteRule ^(.*)$ /%1? [L,R=301]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question