There are links like

ex-film.com/pages/registration.php ex-film.com/pages/films.php 

need to be replaced with links of this type

 ex-film.com/registration.php ex-film.com/films.php 

Wrote such .htaccess, but does not work

 RewriteEngine on RewriteCond %{ENV:REDIRECT_STATUS} ^$ RewriteRule ^pages/(.*) http://%{HTTP_HOST}/$1 [R=301,L] RewriteRule ^$1 /pages/$1 [L] 
  • Here ru.stackoverflow.com/questions/451894/… wrote his answer, it did not work for the TS, although it works fine on localhost. - Visman
  • one
    I'm curious about why you turned on mod_rewrite, but for links, do you want to leave .php at the end? Make at least some minimal routing using PHP and send requests there - tutankhamun
  • @tutankhamun: Maybe the TS uses CMS, and there they didn’t deliver such non-braces. Therefore they beat revraytes and even apache under nginx is put for the sake of such dubious pleasure. - romeo

1 answer 1

 RewriteRule ^registration.php /pages/registration.php [L,QSA] 

 RewriteRule ^films.php /pages/films.php [L,QSA] 
  • On the contrary, you need to get rid of the pages . - romeo
  • So we get rid of the pages. - PoGiS
  • Check your rule . This is how it should be: RewriteRule ^pages\/(.+)$ /$1 [R=301,L] - romeo
  • PoGis, so nothing changes, @romeo writes "Object not found!" - user193921