There is a code that redirects from http://site.ru/system/user.php to http://site.ru/user.php:

RewriteEngine on RewriteRule ^system/user\.php$ /user.php [R=301] 

The problem is this: when it redirects to user.php , it shows 404 not found that the page does not exist, although in reality this is system/user.php . How to fix?

    1 answer 1

    Replace /user.php with user.php

    RewriteEngine on RewriteRule ^system/user\.php$ user.php [R=301]

    Or add a line up: RewriteBase / and do not change anything

    RewriteEngine on RewriteBase / RewriteRule ^system/user\.php$ /user.php [R=301]

    • @ Sharp, RewriteBase / RewriteRule ^ system / user \ .php $ /user.php [R = 301] Does not help. And the first version too .. - ModaL
    • Any other rules in the file? - Sharpness
    • @ Sharp, no. Only these ones .. - ModaL