Hello everyone, there are htacces in which it is written

DirectoryIndex /en/index.php 

Can someone suggest how from the root of the site, make a redirect to the site folder, already went through a bunch of rules but does not want to work ...

Also when adding normally RewriteEngine On to .htaccess. Apache 2 immediately dies by writing Internal Error

 <Directory /home/afgan/apache2/html> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> 
  • DirectoryIndex is the name of the index file for any folder, not the path. - Artem Gorlachev
  • everything was solved, only now the problem is that in the address bar it stupidly shows 127.0.0.1, and I need it to show in the address line 127.0.0.1/en/ is it possible through Directory index ?? - hovdev
  • No, it is possible through 'Redirect' - Artem Gorlachev
  • looking for, redirect, nothing concrete yet - hovdev
  • one
    Redirect 301 index.php /en/index.php - Lieutenant Jim Dangle

1 answer 1

I solved it myself, the problem was as follows.

1 - sudo a2enmod rewrite (it was necessary to register in the terminal)
2 - this is the code that earned.

 RewriteEngine on RewriteCond %{REQUEST_URI} !/az/ RewriteRule ^(.*)$ http://127.0.0.1/az/$1 [L,R=301] 

Here is a brief instruction who may need more.

 1 - /etc/apache2/apache2.conf = AllowOverride All 2 - /etc/apache2/apache2.conf = AccessFileName .htaccess 3 - sudo a2enmod rewrite 

Works on ubuntu 16.04 Add to .htaccess RewriteEngine On
If Apache doesn't give an error, then .htaccess is working.

  • also this option DirectoryIndex /az/index.php helped - hovdev