How to avoid rewriting redirection?

1

I have the following rule in the root:

RewriteEngine On

RewriteRule ^webapp/(.*)$  ./sistema/public/v1/webapp/$1 [L,R=301]

The problem is that when I type in the browser: link

He is redirecting and not rewriting to: link

VHost:

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "/Users/myuser/projects/projetoxyx"
    ServerName projetoxyx.local   
    ServerAlias www.projetoxyx.local
    ErrorLog "logs/dummy-projetoxyz-error.log"
    CustomLog "logs/dummy-projetoxyz-access.log" common

    setEnv APPLICATION_ENV "development"
    <Directory "/Users/myuser/projects/">
        Options Indexes FollowSymLinks Includes execCGI
        AllowOverride All
        Require all granted
   </Directory>
</VirtualHost>

This is system: ./system/public/.htaccess:

RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]

    RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::^B$
    RewriteRule ^(.*)$ - [E=BASE:%1]
    RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]

    Options -Indexes

What do you need to do to prevent it from redirecting?

    
asked by anonymous 13.01.2017 / 20:26

1 answer

1

Removes R=301 , this flag states that it is to do 301 redirection according to the documentation link , but if you just want to rewrite the url, remove it like this:

RewriteEngine On

RewriteRule ^webapp/(.*)$ ./sistema/public/v1/webapp/$1 [L]

I'm not sure, but I believe that ./ is not correct, if sistema/ is in root the correct would be just this:

RewriteEngine On

RewriteRule ^webapp/(.*)$ /sistema/public/v1/webapp/$1 [L]

Some details on this question: What does L, R, NC mean in HTACCESS?

    
14.01.2017 / 01:06