A
A
Artem2015-08-11 22:37:06
Apache HTTP Server
Artem, 2015-08-11 22:37:06

How to prescribe the redirection of certain requests using mod_rewrite?

Good afternoon dear minds. Due to the fact that my knowledge in .htaccess is close to 0, I have to turn to you for help.
there is a project (I give the structure below)
/www
/folder_01
index.php
..htaccess
/folder_02
index.php
..htaccess
/folder_03
index.php
..htaccess
index.php
.htaccess
In the folder_01 folder there is a self-written script that works on the www principle .site.com/controller/action/
at the root of the /www directory in .htaccess the following is written

AddDefaultCharset utf-8
DirectoryIndex index.php
Options -Indexes

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /
    RewriteRule ^(.*)$ folder_01/index.php [QSA,L]
</IfModule>

and in .htaccess located in /folder_01 directory something like this
AddDefaultCharset utf-8

DirectoryIndex index.php
Options -Indexes

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_URI} !(.*)\.(css|js|png|jpg|gif|ico)
    RewriteRule ^(.*)$ index.php?_url=$1 [QSA,L]
</IfModule>

Now the question is how to convert this .htaccess file so that requests
www.site.com/controller/action/ fall into the folder /folder_01
www.site.com/folder_01/controller/action/ fall into the folder /folder_01
www.site.com/folder_02 /controller/action/ got into the folder /folder_02
www.site.com/folder_03/controller/action/ got into the folder /folder_03
folders sometimes scripts will be added or removed
in these folders are not known in advance it can be like wordpress or something then self-written
I will also be grateful for tips on the correct material for studying configuring .htaccess
Thank you all for your attention

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question