服务器 Gind.cn
  • Linux
  • Windows
  • Ubuntu
  1. 服务器 Gind.cn
  2. 重写 301redirect nginx
  3. nginx从.htmredirect到没有的url
Intereting Posts
AWS S3静态主机与自定义域 – 路由裸域 为什么在tcpdumplogging了数据包之后丢包? 为什么Snort不匹配DNS响应? 后缀:如何使别名适用于虚拟域? PHP-FPM + PHP-5.2.14 + NGINX – 给404 yum更新想要更新内核,这可以吗? 如何在Linux系统上显示可用磁盘? 使内核select一个不同的IP地址作为其来源 阿帕奇需要5%的RAM内存 什么是/ sbin / zonename? 我在哪里可以得到CentOS? 在使用rsync后连接SSH的问题 主机不支持SRVlogging,我有什么select? Windows Azure Active Directory同步与Office 365同步有什么区别? Zabbix ssh需要强制伪tty分配 台式机CPU VS服务器CPU性能 – passmark有关吗?

nginx从.htmredirect到没有的url

您好新的网站启动。 前网站有这样的url:

http://example.com/something.htm

新网站没有,看起来像这样:

http://example.com/something

  • htaccess取代了完整的URL而不是REQUEST_URI
  • mod_wsgi,.htaccess和rewriterule
  • 如何防止在htaccess无限redirect循环?
  • 删除/文件夹/从WordPress使用国防部重写?
  • 如何在Debian Lenny上将Apache重写为Apache 2.2

我怎么能告诉nginx做这个redirectpermanetly(301)。

我已经尝试rewrite ^(.*)$ $1.htm permanent; 没有成功。

 location ~*\.(htm)${ rewrite ^(.*)$ $1.htm permanent; } 

  • Apache 2.2重写 – 强制所有的请求index.html
  • Nginx的,PATH_INFO,和URL重写:我必须缺less的东西
  • 如何解释这些htaccess重写规则
  • nginx – 如何… DirectoryIndex到一个文件夹
  • 我如何使虚拟主机DirectoryIndex文件出现在url?

重写如下

 rewrite ^(/.*)\.htm(\?.*)?$ $1$2 permanent; 

为了向前兼容您的旧网站,您可以试试这个

 index index.htm; try_files $uri.htm $uri/ $uri =404; 
  • 这个Apache URL重写规则有什么问题?
  • nginx服务404上的备用位置
  • Nginx将旧的PHPurl视为文件
  • 在nginx上清理URL和php扩展
  • VirtualHosts上的Apache RewriteRule不适用于组捕获正则expression式
  • 如何从我的RewriteRule Htaccess规则中排除一个子文件夹?
  • 为IIS推荐一个好的URL重写工具
  • IIS 7 URL重写规则
  • 如何将页面从一个级别的子目录redirect到根目录
  • nginx重写不工作? 它只是忽略它

  • © 2017 服务器 Gind.cn
  • Topics
  •        
  • Powered by Server
  • Privacy Policy