Welcome! Log In Create A New Profile

Advanced

rewrite help please...

All files from this thread

File Name File Size   Posted by Date  
smime.p7s 6 KB open | download GreenGecko 12/09/2012 Read message
smime.p7s 6 KB open | download GreenGecko 12/09/2012 Read message
smime.p7s 6 KB open | download GreenGecko 12/09/2012 Read message
December 09, 2012 01:08AM
I've got a WP site that also provides landing pages for a number of
other sites. I've set it up as the default server config for that IP,
and that's working fine. However, the requirement I've got is to go to a
specific landing page dependant on domain name. This is how I've gone
about it ( as there are a lot of pages...


map $http_host $page_redirect {
hostnames;

default notset;

..example1.com /link/example1;
....
}

hostname example.com;

location = / {
if ( $page_redirect ~ notset ) {
rewrite ^ /index.php break;
}
# this one works but rewrites the url.
rewrite ^ $page_redirect redirect;
#try_files $page_redirect $page_redirect/ /index.php?$page_redirect;
}

So I'm basically only trying to redirect from http://www.example.com for
example, but not http://www.example.com/index.php, and only from
predefined domains.

As the comment says, this does work if I use a rewrite ... redirect; but
the URL then changes to http://www.example1.com/link/example1, whereas I
want to see http://www.example1.com alone.

The try_files comes up with a 404, which is really perplexing... I
expected it to go through the .php block like the others!

Any ideas what I'm doing wrong?

Cheers,

Steve
--
Steve Holdoway BSc(Hons) MIITP
http://www.greengecko.co.nz
Skype: sholdowa
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Attachments:
open | download - smime.p7s (6 KB)
Subject Author Posted

rewrite help please... Attachments

GreenGecko December 09, 2012 01:08AM

Re: rewrite help please...

Francis Daly December 09, 2012 05:30AM

Re: rewrite help please... Attachments

GreenGecko December 09, 2012 03:52PM

Re: rewrite help please... Attachments

GreenGecko December 09, 2012 04:08PM

Re: rewrite help please...

Francis Daly December 10, 2012 02:52PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 173
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready