Welcome! Log In Create A New Profile

Advanced

Moving .htaccess config to nginx

Posted by kirodan 
kirodan
Moving .htaccess config to nginx
May 21, 2012 01:30PM
Hi,

I have to test nginx for my company which is currently using apache
webservers with .htaccess files. I nearly managed to get all the config
from apache to nginx, but I am having problems with the .htaccess files.
I really have no idea how I should translate this configuration:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}###%{REQUEST_URI}
(.*)/skinimage###.*/skinimage/([^/]+)/([^/]+)$ [NC]
RewriteCond %1/style/%2/images/%3 -f
RewriteRule skinimage/([^/]+)/(.+)$ %{ENV:P4T_DOC}/style/$1/images/$2
[L,NC,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}###%{REQUEST_URI}
(.*)/skinimage###.*/skinimage/[^/]+/([^/]+)$ [OR,NC]
RewriteCond %{REQUEST_FILENAME} (.*)/style/[^/]+/images/(.+)$ [NC]
RewriteCond %1/style/default/images/%2 -f
RewriteRule (skin)?images?/([^/]+/)?(.+)$
%{ENV:P4T_DOC}/style/default/images/$3 [L,NC,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}###%{REQUEST_URI}
(.*)/skinimage###.*/skinimage/[^/]+/([^/]+)$ [OR,NC]
RewriteCond %{REQUEST_FILENAME} (.*)/style/[^/]+/images/(.+)$ [NC]
RewriteCond %1/images/%2 -f
RewriteRule (skin)?images?/([^/]+/)?(.+)$ %{ENV:P4T_DOC}/images/$3
[L,NC,QSA]

## Deny access to .svn directory via Web ##
RewriteRule .*\.svn/.* - [F]


I am not even sure if I understand this config correct:
If REQUEST_FILENAME does not exist, check if it matches some regex, and
then rewrite it with some parts of the none-existent path.

Could you please help me to apply this config to nginx?

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,226685,226685#msg-226685

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Denis
Re: Moving .htaccess config to nginx
May 21, 2012 01:50PM
hi
take a look over here, it will give you some idea
http://winginx.ru/htaccess


On 21/5/2012 12:29, kirodan wrote:
> Hi,
>
> I have to test nginx for my company which is currently using apache
> webservers with .htaccess files. I nearly managed to get all the config
> from apache to nginx, but I am having problems with the .htaccess files.
> I really have no idea how I should translate this configuration:
>
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME}###%{REQUEST_URI}
> (.*)/skinimage###.*/skinimage/([^/]+)/([^/]+)$ [NC]
> RewriteCond %1/style/%2/images/%3 -f
> RewriteRule skinimage/([^/]+)/(.+)$ %{ENV:P4T_DOC}/style/$1/images/$2
> [L,NC,QSA]
>
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME}###%{REQUEST_URI}
> (.*)/skinimage###.*/skinimage/[^/]+/([^/]+)$ [OR,NC]
> RewriteCond %{REQUEST_FILENAME} (.*)/style/[^/]+/images/(.+)$ [NC]
> RewriteCond %1/style/default/images/%2 -f
> RewriteRule (skin)?images?/([^/]+/)?(.+)$
> %{ENV:P4T_DOC}/style/default/images/$3 [L,NC,QSA]
>
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME}###%{REQUEST_URI}
> (.*)/skinimage###.*/skinimage/[^/]+/([^/]+)$ [OR,NC]
> RewriteCond %{REQUEST_FILENAME} (.*)/style/[^/]+/images/(.+)$ [NC]
> RewriteCond %1/images/%2 -f
> RewriteRule (skin)?images?/([^/]+/)?(.+)$ %{ENV:P4T_DOC}/images/$3
> [L,NC,QSA]
>
> ## Deny access to .svn directory via Web ##
> RewriteRule .*\.svn/.* - [F]
>
>
> I am not even sure if I understand this config correct:
> If REQUEST_FILENAME does not exist, check if it matches some regex, and
> then rewrite it with some parts of the none-existent path.
>
> Could you please help me to apply this config to nginx?
>
> Posted at Nginx Forum: http://forum.nginx.org/read.php?2,226685,226685#msg-226685
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx


--
-= MagenX =-
Optimizing Your Magento and Nginx Performance
Magento Bronze Solution Partner
www.magenx.com

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
kirodan
Re: Moving .htaccess config to nginx
May 22, 2012 12:20PM
Thank you, that helps alot.

dedo Wrote:
-------------------------------------------------------
> hi
> take a look over here, it will give you some idea
> http://winginx.ru/htaccess
>
>
> On 21/5/2012 12:29, kirodan wrote:
> > Hi,
> >
> > I have to test nginx for my company which is
> currently using apache
> > webservers with .htaccess files. I nearly
> managed to get all the config
> > from apache to nginx, but I am having problems
> with the .htaccess files.
> > I really have no idea how I should translate
> this configuration:
> >
> > RewriteCond %{REQUEST_FILENAME} !-f
> > RewriteCond %{REQUEST_FILENAME}###%{REQUEST_URI}
> > (.*)/skinimage###.*/skinimage/([^/]+)/([^/]+)$
> [NC]
> > RewriteCond %1/style/%2/images/%3 -f
> > RewriteRule skinimage/([^/]+)/(.+)$
> %{ENV:P4T_DOC}/style/$1/images/$2
> > [L,NC,QSA]
> >
> > RewriteCond %{REQUEST_FILENAME} !-f
> > RewriteCond %{REQUEST_FILENAME}###%{REQUEST_URI}
> > (.*)/skinimage###.*/skinimage/[^/]+/([^/]+)$
> [OR,NC]
> > RewriteCond %{REQUEST_FILENAME}
> (.*)/style/[^/]+/images/(.+)$ [NC]
> > RewriteCond %1/style/default/images/%2 -f
> > RewriteRule (skin)?images?/([^/]+/)?(.+)$
> > %{ENV:P4T_DOC}/style/default/images/$3
> [L,NC,QSA]
> >
> > RewriteCond %{REQUEST_FILENAME} !-f
> > RewriteCond %{REQUEST_FILENAME}###%{REQUEST_URI}
> > (.*)/skinimage###.*/skinimage/[^/]+/([^/]+)$
> [OR,NC]
> > RewriteCond %{REQUEST_FILENAME}
> (.*)/style/[^/]+/images/(.+)$ [NC]
> > RewriteCond %1/images/%2 -f
> > RewriteRule (skin)?images?/([^/]+/)?(.+)$
> %{ENV:P4T_DOC}/images/$3
> > [L,NC,QSA]
> >
> > ## Deny access to .svn directory via Web ##
> > RewriteRule .*\.svn/.* - [F]
> >
> >
> > I am not even sure if I understand this config
> correct:
> > If REQUEST_FILENAME does not exist, check if it
> matches some regex, and
> > then rewrite it with some parts of the
> none-existent path.
> >
> > Could you please help me to apply this config to
> nginx?
> >
> > Posted at Nginx Forum:
> http://forum.nginx.org/read.php?2,226685,226685#ms
> g-226685
> >
> > _______________________________________________
> > nginx mailing list
> > nginx@nginx.org
> > http://mailman.nginx.org/mailman/listinfo/nginx
>
>
> --
> -= MagenX =-
> Optimizing Your Magento and Nginx Performance
> Magento Bronze Solution Partner
> www.magenx.com
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,226685,226713#msg-226713

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Sorry, only registered users may post in this forum.

Click here to login