0

I'm looking to have a certain page, example.php, redirect to the non-SSL version if it is accessed via SSL. What type of rewrites should I be looking at?

1 Answer 1

1

The following code may be used...

server {
  listen 443 ssl;
  server_name domainname.com;

  ssl_certificate /path/to/cert.crt;
  ssl_certificate_key /path/to/cert.key;

  location = /path/to/example.php {
    return 301 http://$host$request_uri;
  }

  # other directives here
}

server {
  listen 80;
  server_name domainname.com;

  location = /path/to/example.php {
    # include directives to process PHP here
  }

  # return all other requests to SSL
  location / {
    return 301 https://$host$request_uri;
  }
}
2
  • I have my SSL and non-SSL server block in one block.
    – Artie
    Aug 23, 2013 at 23:45
  • Is it hard to split / divide it? Aug 24, 2013 at 3:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .