Htaccess

Hi,

I am pasting part of my .htacess file used in Apache; please help me to
convert this to nginx configuraiton settings:


############################################

enable rewrites

Options +FollowSymLinks
RewriteEngine on

############################################

you can put here your magento root folder

path relative to web root

#RewriteBase /magento/

############################################

uncomment next line to enable light API calls processing

RewriteRule ^api/([a-z][0-9a-z_]+)/?$ api.php?type=$1 [QSA,L]

############################################

rewrite API2 calls to api.php (by now it is REST only)

RewriteRule ^api/rest api.php?type=rest [QSA,L]

############################################

workaround for HTTP authorization

in CGI environment

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

############################################

TRACE and TRACK HTTP methods disabled to prevent XSS attacks

RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
RewriteRule .* - [L,R=405]

############################################

redirect for mobile user agents

#RewriteCond %{REQUEST_URI} !^/mobiledirectoryhere/.*$
#RewriteCond %{HTTP_USER_AGENT}

“android|blackberry|ipad|iphone|ipod|iemobile|opera
mobile|palmos|webos|googlebot-mobile” [NC]
#RewriteRule ^(.*)$ /mobiledirectoryhere/ [L,R=302]

############################################

always send 404 on missing files in these folders

RewriteCond %{REQUEST_URI} !^/(media|skin|js)/

############################################

never rewrite for existing files, directories and links

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

############################################

rewrite everything else to index.php

RewriteRule .* index.php [L]
....................................................

Thank You.

Posted at Nginx Forum:

How about taking a look at Winginx - Local web server for PHP5, MySQL, MongoDB, Node.js developers. ?

Yours sincerely,
Christopher M.

Ambassador/Contributor of Fedora Project and many others.

http://winginx.com/htaccess
resulted :

=====================

nginx configuration

index index.php;

charset off;

location ~ /(media|skin|js)/ {
}

location /api {
rewrite ^/api/rest /api.php?type=rest break;
}

location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php break;
}
}

location /RELEASE_NOTES.txt {
deny all;
}

================
But I already have a ‘location’ settings in my nginx.conf:

location / {
root /var/www/html;
index index.php index.html index.htm;
fastcgi_param REDIRECT_STATUS 200;
}

how can i merge both of this?

Posted at Nginx Forum:

http://winginx.com/htaccess
resulted :

=====================

nginx configuration

index index.php;

charset off;

location ~ /(media|skin|js)/ {
}

location /api {
rewrite ^/api/rest /api.php?type=rest break;
}

location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php break;
}
}

location /RELEASE_NOTES.txt {
deny all;
}

================
But I already have a ‘location’ settings in my nginx.conf:

location / {
root /var/www/html;
index index.php index.html index.htm;
fastcgi_param REDIRECT_STATUS 200;
}

how can i merge both of this?

Posted at Nginx Forum: