need help converting .htaccess to nginx directive but with *two* primary location entries

zoldos

Well-known member
So I'm trying to convert some Apache .htaccess rules to nginx. The first set of directives, shown below, works, so I don't need to use Apache Re-write (and thus, no .htaccess). The second code block is the NON-converted .htaccess code for my chat room which I'd like to convert, then combine in with the existing directive below.

Can anyone please assist? I'm getting a lot of issues with the initial location directive, since it appears I can't have 2 at once. Can they be combined? Is there a workaround? My IM chat won't work until the directives are applied. :(

Thanks!

location / {
try_files $uri $uri/ ///index.php?$uri&$args;
index index.php index.html;
}

location ///install/data/ {
internal;
}
location ///install/templates/ {
internal;
}
location ///internal_data/ {
internal;
}
location ///library/ { #legacy
internal;
}
location ///src/ {
internal;
}

Convert below to nginx and combine with above!

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^chatroom ^/../public/chatroom/ [L]
RewriteRule ^cron ^/../public/cron/ [L]
RewriteRule ^debug ^/../public/debug/ [L]
RewriteRule ^list ^/../public/list/ [L]
RewriteRule ^mobile ^/../public/mobile/ [L]
RewriteRule ^popout ^/../public/popout/ [L]
RewriteRule ^video ^/../public/video/ [L]
</IfModule>

<IfModule mod_headers.c>
<FilesMatch "\.(gif|jpg|png|css|swf)$">
Header add "Expires" "Mon, 28 Jul 2014 23:30:00 GMT"
Header add "Cache-Control" "max-age=31536000"
</FilesMatch>
</IfModule>

<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A604800
ExpiresByType text/css A604800
ExpiresByType image/gif A604800
ExpiresByType image/png A604800
ExpiresByType image/jpeg A604800
ExpiresByType application/x-shockwave-flash A604800
</IfModule>

Thanks!!!
 
Top Bottom