rewrite rule to remove trailing dot from hostname
Andrew Grim
lists at ruby-forum.com
Wed Aug 27 04:11:32 MSD 2008
Here's the issue:
Right now users can browse my site via either "http://<hostname>.com" or
"http://<hostname>.com.". Notice the trailing dot. So because of some
flash security issues I want to redirect the hostname with the trailing
dot to my regular hostname. Should be easy, right?
I've tried a bunch of things, and it appears that $host doesn't include
the trailing dot. But if it doesn't, does anything?
if ($host ~ "<host_name>.com\." ){
rewrite ^(.*) http://<%= http_host_name %>$1 permanent;
}
I've also tried
if ($host ~ "\.$" ){
rewrite ^(.*) http://<%= http_host_name %>$1 permanent;
}
And a number of other things. Any ideas would be greatly appreciated!
--
Posted via http://www.ruby-forum.com/.
More information about the nginx
mailing list