jeudi 1 janvier 2015

NGINX Rewrite single HTTPS URL to HTTP


Vote count:

0




On my NGINX server, I have all non-SSL traffic redirected to my SSL site.


Now, I want to have a single URL excluded from this, specifically: http://ift.tt/1Bpt5pj and everything appended to pages.php, such as pages.php?page=blahblah redirected to http://ift.tt/1ER1DXG , etc.


My config file looks like this so far, but I've not had any luck in getting any rewrite rules to work:



server {
server_name
www.pyronexus.com
;

listen 80 default;
listen 443 ssl;

ssl_certificate ssl/pyronexus.com.crt;
ssl_certificate_key ssl/pyronexus.com.key;

return 301 http://ift.tt/1ER1DXI;
}

server {
server_name
pyronexus.com
;

listen 80;
listen 443 default ssl;

ssl_certificate ssl/pyronexus.com.crt;
ssl_certificate_key ssl/pyronexus.com.key;

root /home/nginx/pyronexus.com/public;
index index.html index.php;

access_log /home/nginx/http://ift.tt/1jjS4H5;
error_log /home/nginx/http://ift.tt/1jjS7Ct;

include php.conf;
include mime.types;

location /forum/ {
#include pyronexus-naxsi.rules;
rewrite ^/forum/forum-([0-9]+)\.html$ /forum/forumdisplay.php?fid=$1;
rewrite ^/forum/forum-([0-9]+)-page-([0-9]+)\.html$ /forum/forumdisplay.php?fid=$1&page=$2;
rewrite ^/forum/thread-([0-9]+)\.html$ /forum/showthread.php?tid=$1;
rewrite ^/forum/thread-([0-9]+)-page-([0-9]+)\.html$ /forum/showthread.php?tid=$1&page=$2;
rewrite ^/forum/thread-([0-9]+)-lastpost\.html$ /forum/showthread.php?tid=$1&action=lastpost;
rewrite ^/forum/thread-([0-9]+)-nextnewest\.html$ /forum/showthread.php?tid=$1&action=nextnewest;
rewrite ^/forum/thread-([0-9]+)-nextoldest\.html$ /forum/showthread.php?tid=$1&action=nextoldest;
rewrite ^/forum/thread-([0-9]+)-newpost\.html$ /forum/showthread.php?tid=$1&action=newpost;
rewrite ^/forum/thread-([0-9]+)-post-([0-9]+)\.html$ /forum/showthread.php?tid=$1&pid=$2;
rewrite ^/forum/post-([0-9]+)\.html$ /forum/showthread.php?pid=$1;
rewrite ^/forum/announcement-([0-9]+)\.html$ /forum/announcements.php?aid=$1;
rewrite ^/forum/user-([0-9]+)\.html$ /forum/member.php?action=profile&uid=$1;
rewrite ^/forum/calendar-([0-9]+)\.html$ /forum/calendar.php?calendar=$1;
rewrite ^/forum/calendar-([0-9]+)-year-([0-9]+)\.html$ /forum/calendar.php?action=yearview&calendar=$1&year=$2;
rewrite ^/forum/calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)\.html$ /forum/calendar.php?calendar=$1&year=$2&month=$3;
rewrite ^/forum/calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)-day-([0-9]+)\.html$ /forum/calendar.php?action=dayview&calendar=$1&yea$
rewrite ^/forum/calendar-([0-9]+)-week-(n?[0-9]+)\.html$ /forum/calendar.php?action=weekview&calendar=$1&week=$2;
rewrite ^/forum/event-([0-9]+)\.html$ /forum/calendar.php?action=event&eid=$1;
rewrite ^/forum/archive/index\.php/forum-([0-9]+)\.html$ /forum/archive/index.php?forum-$1.html;
rewrite ^/forum/archive/index\.php/thread-([0-9]+)\.html$ /forum/archive/index.php?thread-$1.html;
}

location ~ /forum/(inc) {
deny all;
}
}


The rewrite rule I have tried is this, but I'm still getting to grips on how these rules work:



rewrite ^http://ift.tt/1Bpt5pn http://ift.tt/1ER1Ee7;


asked 28 secs ago







NGINX Rewrite single HTTPS URL to HTTP

Aucun commentaire:

Enregistrer un commentaire