Nginx Joomla 1.5 Rewrite Rules

Joomla 1.5 Rewrite Rules
Hacks – Snippets
Wednesday, 11 March 2009 13:22
Working nginx.conf for Joomla 1.5 URL rewrites. Feel free to use and redistribute.

server {

# nginx Rewrite rules for Joomla 1.5 – Daniel Waardal – nginx.nu 2009 –
# Feel free to use this in any way you’d like.

#Port to bind nginx to:
listen 80;
#Your Domain name:
server_name localhost;

#This is to avoid POST requests resulting in a 405 error
if ($request_method = POST ) {
rewrite ^(/administrator) /administrator/index.php?q=$1 last;
rewrite (.*) /index.php?q=$1 last;
break;
}
location / {

#Path to your Joomla directory
root /var/www/joomla/;
index index.html index.htm index.php;
error_page 404 = @joomla;
}
# Uncomment the following three lines to force browsers to cache static files, thus making the user experience snappier.
# location ~* /files/.*\.(gif|jpg|jpeg|png|css)$ {
# expires max;
# }

location @joomla {
rewrite ^(.*)$ /index.php?q=$1 last;
}
}

source : http://nginx.nu/hacks

Tinggalkan komentar