rewrite rules

Jan Ślusarczyk jan.slusarczyk at
Thu Jan 31 16:32:19 MSK 2008

Thanks for all the tips. For a combination of Typo3 installation on  
root (realurl rewriting to /index.php) and vbseo enhanced vbulletin  
in /forum/ directory of a main site I've come up with the following:

server {
	server_name	www.servername.tld;
	access_log	/var/log/nginx/www.servername.tld.access.log	combined;

	root	/var/www/hosts/www.servername.tld;
     index  index.php index.html index.htm;

	location ~ /\.ht {
		deny all;
	location /forum/ {
		rewrite ^/forum/((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ /forum/ 
vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last;
		if ($request_filename ~ "\.php$" ) {
			rewrite ^(.*)$ /forum/vbseo.php?vbseourl=$1 last;
		if (!-e $request_filename) {
			rewrite ^/forum/(.*)$ /forum/vbseo.php?vbseourl=$1 last;
	location / {
		if (!-e $request_filename) {
			 rewrite ^(.*)$ /index.php last;
	location ~ \.php$ {
         fastcgi_index  index.php;
         fastcgi_param  SCRIPT_FILENAME  /var/www/hosts/www.servername.tld 
		include        /etc/nginx/fastcgi.conf;

Does it make sense? Can it be better? Anything I should be aware of?
Thank you

More information about the nginx mailing list