How to create a proper PHP redirect APACHE?

How to make the request url site.ru/name_folder/ content was loaded from the folder site.ru/myfolders/name_folder which name name_folder the same!?
It is also necessary to exclude folders site.ru/js, site.ru/css. And it does not change the url in the address bar
Used PHP, apache
June 8th 19 at 16:44
1 answer
June 8th 19 at 16:46
in .htaccess

RewriteEngine On

RewriteCond %{REQUEST_URI} !^/myfolders/.*$
RewriteRule ^(.*)$ /myfolders/$1 [QSA,L]
and if you need to exclude folders site.ru/js, site.ru/css. And it does not change the url in the address bar - nikita.Stracke commented on June 8th 19 at 16:49
then
RewriteCond %{REQUEST_URI} ^/name_folder/.*$
 RewriteRule ^(.*)$ /myfolders/$1 [QSA,L]
- Rose_Rodrigu commented on June 8th 19 at 16:52
And what has changed? how to exclude the folder that the js and css for example - nikita.Stracke commented on June 8th 19 at 16:55
changed the rule, now it handles only the desired section - Rose_Rodrigu commented on June 8th 19 at 16:58
the point is that it is necessary to exclude some folders (site.ru/css, site.ru/js), and all the other millions variaton will be redirected in site.ru/myfolder/unikalnoe_nazvanie - nikita.Stracke commented on June 8th 19 at 17:01
then these few folders to list, by analogy with the first option
RewriteCond %{REQUEST_URI} !^/myfolders/.*$
 RewriteCond %{REQUEST_URI} !^/css/.*$
 RewriteCond %{REQUEST_URI} !^/js/.*$
 RewriteRule ^(.*)$ /myfolders/$1 [QSA,L]
- Rose_Rodrigu commented on June 8th 19 at 17:04
Thank You Andrey! - nikita.Stracke commented on June 8th 19 at 17:07
If requested site.ru/name_folder/ loads the contents of site.ru/myfolder/name_folder/ all is well here. But if the requested site.ru/name_folder (without the slash at the end) that throws on site.ru/myfolder/name_folder/. I.e. address changes and need to leave. - nikita.Stracke commented on June 8th 19 at 17:10

Find more questions by tags Apache