Good day, the second day I’m fighting a problem. There are two sites http://admin.example.ru and http://example.ru , they are located on the hosting like this: /home/p111111/www/admin.example.ru/ and /home/p111111/www/example.ru/ . You need to configure via .htaccess internal redirect so that all http://admin.example.ru files are taken from http://example.ru/admin , but attention, without reloading and changing the url. For simplicity, I still try to redirect to a single file, but this code does not work.

 Options +FollowSymLinks RewriteEngine On RewriteBase /home/p111111/www/example.ru/ RewriteRule test.php admin/test.php 

At first I thought it was hosting jokes, I tried to do it locally on the Apache, I constantly get an error 403 (Forbidden).

    1 answer 1

    So you should not work. RewriteBase is a url that is added to the result of the processing by the rules, and not the physical path on the server. You need to use symlinks on directories or redirect.

    • Redirect is not what you need, but how to use symlinks? - Klym
    • So I created through the symboliclink console to the /home/p111111/www/example.ru/admin directory, how can I specify in htaccess so that the files are taken through it? - Klym
    • one
      You do not need .htaccess if you made a symlink. This is the same as physically moving files to the correct directory. - Andrew Hobbit
    • Well, it does not work, maybe I'm doing something wrong, I will give a simplified example. Suppose I have the file /home/p111111/www/example.ru/admin/test.php and I /home/p111111/www/example.ru/admin/test.php it with this command: ln -s www/example.ru/admin/test.php www/admin.example.ru/test , ie when I enter admin.example.ru/test , should I open that test.php file? - Klym
    • If you make a symlink to the directory, for example: ln -s /home/p111111/www/example.ru/admin /home/p111111/www/admin.example.ru and go to admin.example.ru/test.php , then the script /home/p111111/www/example.ru/admin/test.php is executed, of course, if such a file exists. - Andrew Hobbit