Nginx

NGINX:301 次重寫

  • October 19, 2011

我有一個要在 Nginx 中設置的 301 次重寫列表。我想準確地指定 uri 而不是使用正則表達式。這樣做的寫入方法是什麼?

這是我認為應該做的:

rewrite /o-atipico /rogerio-madureira.htm permanent;
rewrite /CHANGELOG.txt / permanent;
rewrite /MaxLucado / permanent;
rewrite /adwords / permanent;
rewrite /animals.txt / permanent;
rewrite /apresentacao / permanent;
rewrite /arquivos / permanent;
rewrite /atipico / permanent;
rewrite /atipico.com.br / permanent;
rewrite /baix / permanent;
rewrite /baixe.asp / permanent;
rewrite /blog / permanent;
rewrite /c / permanent;
rewrite /calendario.asp / permanent;
rewrite /capture.asp / permanent;
rewrite /contato / permanent;
rewrite /contato.asp / permanent;
rewrite /conteudo.asp / permanent;
rewrite /cu / permanent;
rewrite /cur / permanent;
rewrite /curs / permanent;
rewrite /curso / permanent;
rewrite /curso.asp / permanent;
rewrite /cursoempresa.asp / permanent;
rewrite /cursoindividual.asp / permanent;
rewrite /cursoonline.asp / permanent;
rewrite /cursopresencial.asp / permanent;
rewrite /empreendedor / permanent;
rewrite /empresário / permanent;
rewrite /error_log / permanent;
rewrite /exemplo-de-codifo-semantico.html / permanent;
rewrite /favicon.bmp / permanent;
rewrite /function.file-put-contents / permanent;
rewrite /function.getimagesize / permanent;
rewrite /function.include / permanent;
rewrite /galeria.html / permanent;
rewrite /google / permanent;
rewrite /home.htm / permanent;
rewrite /home.xsl / permanent;
rewrite /hospedagem-de-sites / permanent;
rewrite /i / permanent;
rewrite /ideias-em-curso.php / permanent;
rewrite /index.php5 / permanent;
rewrite /inex.htm / permanent;
rewrite /ivar.html / permanent;
rewrite /marketing.htm / permanent;
rewrite /matricula.asp / permanent;
rewrite /me / permanent;
rewrite /muieblackcat / permanent;
rewrite /natal / permanent;
rewrite /news / permanent;
rewrite /news.html / permanent;
rewrite /obrigado / permanent;
rewrite /overview.asp / permanent;
rewrite /pagina.html / permanent;
rewrite /palestra / permanent;
rewrite /participe.asp / permanent;
rewrite /performance-de-sites / permanent;
rewrite /pesquisa.htm / permanent;
rewrite /prodo / permanent;
rewrite /prodo.asp / permanent;
rewrite /promocao. / permanent;
rewrite /promocao.asp / permanent;
rewrite /promoparti.asp / permanent;
rewrite /propaganda-e-anuncios-de / permanent;
rewrite /r / permanent;
rewrite /results.aspx / permanent;
rewrite /robost.txt / permanent;
rewrite /robots.txt / permanent;
rewrite /seo / permanent;
rewrite /shorinji / permanent;
rewrite /sites / permanent;
rewrite /sualoja.asp / permanent;
rewrite /teste.htm / permanent;
rewrite /treinamento-de-marketing.htm / permanent;
rewrite /treinamento-de-seo.htm / permanent;
rewrite /treinamento-de-vendas.htm / permanent;
rewrite /treinamentos.asp / permanent;
rewrite /vcard / permanent;
rewrite /vendas / permanent;
rewrite /vendas.htm / permanent;
rewrite /vendedor / permanent;
rewrite /xml.asp / permanent;

這是最好的方法嗎?

謝謝。

我會使用地圖來做到這一點。

也可能將映射放置到不同的文件中並包含它。

它確實達到了相同的效果,但在我看來,它更易於閱讀。

請參閱:http
://wiki.nginx.org/HttpMapModule 第二個範例幾乎是您想要做的。

引用自:https://serverfault.com/questions/322971