Rewrite except for single uri

Edward Stow ed.stow at gmail.com
Mon Aug 3 08:45:05 MSD 2009


Hi

I have a small site that has a buy page with ssl :
https://shop.abc.tld/buy.html

I want all requests to other pages to be re-directed to http such as

https://shop.abc.tld/index.html  --> http://abc.tld/index.html

https://shop.abc.tld/buy.html passes through unchanged

I do not want to have explicitly list the other pages in the rewrite
as shown for obvious reasons.
The list has been edited down for brevity.

Any better suggestions.

server	
	{
	listen		443;
	server_name		shop.abc.tld;
	ssl			on;
	ssl_certificate		/etc/ssl/certs/shop.abc.tld.crt;
	ssl_certificate_key	/etc/ssl/private/shop.abc.tld.key;
	
	access_log		/var/log/nginx/abc.tld.access.log;
			
	location 	/
	#Must be a better way to rewrite
		{
		rewrite		^/(index|about|contact|delivery|refund|privacy|credits)\.html$	http://abc.tld/$1.html
permanent;
		
		root	/srv/www/abc.tld/html;
		index	buy.html;
		ssi		on;
		}
	}

-- 

Edward





More information about the nginx mailing list