Rewrite except for single uri
Igor Sysoev
is at rambler-co.ru
Mon Aug 3 09:06:25 MSD 2009
On Mon, Aug 03, 2009 at 02:45:05PM +1000, Edward Stow wrote:
> 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;
> }
> }
root /srv/www/abc.tld/html;
location = / {
index buy.html;
ssi on;
}
location = /buy.html {
ssi on;
}
location / {
rewrite ^ http://abc.tld/$request_uri?;
}
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list