How to create a rewrite rule to read a repository from a site subdirectory

1

I have two folders in my root:

  

www / repo-sp /
  www / repo-rj /

My virtual host (www.mysite.local) points to www/repo-sp/ :

When typing /rio at the end of the site, it should point to www/repo-rj/ , that is, www.meusite.local/rio/

The problem is that I can not play any .htaccess files in the root of these www/repo-rj/ and www/repo-sp/ folders, but I can play in www or in a subdirectory of the /www/repo-sp/rio/ repository.

Another problem is that I also need to keep the idea that /rio/ should be maintained when clicking on the menu link, for example "www.mysite.local / rio / link.html" when inside the river directory .

What I tried and did not work for was putting the rule in a .htaccess file inside the folder:

RewriteEngine on
RewriteRule ^(.*)$ /www/repo-rj/$1
    
asked by anonymous 29.04.2016 / 16:26

1 answer

1

You could do something like this in .htaccess at the root of www:

RewriteRule ^rio/(.+) /repo-rio/$1 [NC]

In this rule it will take what is after the bar and direct completely to the '/ rio'.

I did not test, but it could be a form or a start

Update:

I came up with something interesting here, .htaccess remains at the root of www:

<IfModule mod_rewrite.c>

    RewriteEngine on
    RewriteCond %{THE_REQUEST} ^GET\ /repo-rj/
    RewriteRule ^repo-rj/(.*)$ rio/$1 [R,L]

    RewriteRule ^rio/(.*)$ repo-rj/$1

</IfModule>

    

29.04.2016 / 19:25