Beginner's question: redirecting /dir/index.html to /dir/

Eugaia ngx.eugaia at gmail.com
Mon Sep 13 21:41:03 MSD 2010


  Change 'permanent' to 'redirect'.

Marcus.

On 13/09/2010 18:39, ez77 wrote:
>> In this configuration:
>>
>> rewrite ^(.*/)index.html http://$host$1 permanent;
>>
>> location / {
>> index index.html;
>> }
>>
>> nginx will not run the server level rewrite, after the internal
> redrect,
>> so there will not be the loop.In this configuration:
>>
>> rewrite ^(.*/)index.html http://$host$1 permanent;>
>>
>> location / {
>> index index.html;
>> }
>>
>> nginx will not run the server level rewrite, after the internal
> redrect,
>> so there will not be the loop.
> I still get a redirect this way. Let me point out the "mysite"
> configuration file under /etc/nginx/sites-available/ (too embarrassed to
> give the actual highly-in-construction site):
>
> server {
> 	listen   mysite:80;
> 	server_name  .mysite;
>          if ($host ~* .\.(mysite.*)) {
>                  set $host_without_www $1;
>                  rewrite ^(.*)$ http://$host_without_www$1 permanent;
>          }
>
> 	access_log  /var/log/nginx/mysite.access.log;
>
>      rewrite ^(.*/)index.html http://$host$1 permanent;
>
> 	location / {
> 	    root   /var/www/mysite;
> 	    index  index.html index.htm;
> 	}
> 	error_page   500 502 503 504  /50x.html;
> 	location = /50x.html {
> 		root   /var/www/mysite;
> 	}
> }
>
> Posted at Nginx Forum: http://forum.nginx.org/read.php?2,128951,130089#msg-130089
>
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx




More information about the nginx mailing list