Welcome! Log In Create A New Profile

Advanced

Re: Rewriting request to www.domain.com to domain.com

January 31, 2011 08:52AM
On Mon, Jan 31, 2011 at 07:53:58PM +0900, Zev Blut wrote:

> Hello,
>
>
> I am having a hard time getting the following type of domain rewrite to
> work. This is what I have so far:
>
>
> server {
> listen 80;
>
> charset off;
> server_name www.foobar.com;
>
> access_log /var/log/nginx/iknow_access.log cerelog;
> location / {
> rewrite ^ http://foobar.com permanent;
> }
>
> location /widgets/ {
> return 410;
> }
> location /banners/ {
> return 410;
> }
>
> error_page 404 410 /404.html;
> location = /404.html {
> root /data/foobar/current/public;
> }
> }
>
>
> I want it to rewrite all requests to the www.foobar.com to the flat
> level domain of foobar.com.
>
> I.e. www.foobar.com/awesomelink should be foobar.com
>
> But, I am getting foobar.com/awesomelink instead.
>
> Also, the 410 responses are redirecting just like the location /
> This is with Nginx 0.7.65
>
> Any ideas what I am doing wrong?

This configuration should work. Probably, your browser has cached
old permanent redirects. Or your real configuration is more complex
than this.


--
Igor Sysoev
http://sysoev.ru/en/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Rewriting request to www.domain.com to domain.com

Zev Blut January 31, 2011 06:02AM

Re: Rewriting request to www.domain.com to domain.com

António P. P. Almeida January 31, 2011 08:20AM

Re: Rewriting request to www.domain.com to domain.com

António P. P. Almeida January 31, 2011 09:10AM

Re: Rewriting request to www.domain.com to domain.com

Igor Sysoev January 31, 2011 08:52AM

Re: Rewriting request to www.domain.com to domain.com

Zev Blut January 31, 2011 09:44PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 148
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