apache - url routing from root with index.php and htaccess in sub-directory -


I want to know that it is possible to do this:

In all files to keep the route clean From, I want to keep everything under the sub-directory (index.php, .htaccess, ...). It is possible to configure a rule in .htaccess that resides in this subdirectory, to redirect index.php from the root directory that resides in the subdirectory?

Then what will be the syntax for this? Htaccess

A .htaccess file has only / on effect:

  • In that directory
  • The sub-directory of that directory

So, no, you have .htaccess in a directory, depending on what is in the root directory: Apache will not even see that .htaccess file.


If you want something like that, you have to keep it at a higher level; Either:

  • In the .htaccess file in parent (which seems like you do not want to do it)
  • Or in the configuration of Apache directly - in the configuration of your virtualhost, for example.

Comments