Convert nginx redirect rule to .htaccess

-1

I have the following rule on an Nginx server in production:

server {
    server_name meusite.srv.br;
    rewrite ^(.*) http://www.meusite.srv.br$1 permanent;

}

server {         server_name www.meusite.srv.br;         access_log /home/project/prod/nginx/logs/access.log;         error_log /home/project/prod/nginx/logs/error.log;         root / home / projectproject / prod / public_html;

gzip  on;
    gzip_http_version 1.1;
    gzip_vary on;
    gzip_comp_level 6;
    gzip_proxied any;
    gzip_types image/png image/gif image/jpeg image/x-icon text/css text/cache-manifest font/truetype font/opentype font/woff application/vnd.ms-fontobject application/json application/javascript application/x-javascript text/javascript text/xml application/xml application/rss+xml application/atom+xml$

    gzip_buffers 16 8k;

    # Disable gzip for certain browsers.
    gzip_disable msie6;

    location / {
            index       index.html      index.php;
    try_files $uri $uri/ @rewrite_prod;
    }

location @rewrite_prod {

            rewrite ^/ajax/(.*)?$  /app/controller/ajax/$1.caj.php last;
            rewrite ^/data/(.*)?$  /app/controller/data/$1.data.php last;

            rewrite ^/([^/]*)/favicon.ico$  /favicon.ico last;

            rewrite  ^/([^/]*)(/([^/]*)/?)?(/([^/]*)/?)?$ /index.php?page=$1&action=$3&value=$5  last;
    }

location ~*\.(eot|otf|svg|ttf|woff)$ {
            add_header Access-Control-Allow-Origin *;
    }

    location ~ /(.+)\.(inc.php|class.php|add.php|edit.php|search.php|ws.php|auto.php|cfg.php|cfc.php|cfg.xml)$ {
             deny all;
    }

    location ~ \.php$ {
        include /etc/nginx/fastcgi_params;
        fastcgi_read_timeout 300;
    fastcgi_buffer_size 128k;
        fastcgi_buffers 4 256k;
        fastcgi_busy_buffers_size 256k;
    fastcgi_pass unix:/var/run/php5-fpm.sock;                                                                                                                                                  
        fastcgi_index index.php;                                                                                                                                                            
        fastcgi_param SCRIPT_FILENAME /home/pastaprojeto/prod/public_html$fastcgi_script_name;                                                                                                              
    }                                                                                                                                                                                       

}

I do not understand ER and I need this rule in an .htaccess file for apache. I tried some ways but I could not.

How can I transcribe this?

    
asked by anonymous 23.08.2014 / 15:21

1 answer

0

Try the following settings:

RewriteEngine On
RewriteRule ^/ajax/(.*)?$ /app/controller/ajax/$1.caj.php
RewriteRule ^/data/(.*)?$ /app/controller/data/$1.data.php
RewriteRule ^/([^/]*)/favicon.ico$ /favicon.ico
RewriteRule ^/([^/]*)(/([^/]*)/?)?(/([^/]*)/?)?$ /index.php?page=$1&action=$3&value=$5

Do not forget to enable the Apache rewrite module. :)

    
23.08.2014 / 16:41