.htaccess - 使用正则表达式的 HtAccess 重定向

标签 .htaccess zend-framework redirect seo

有谁知道如何为这个 url 设置重定向:

旧网址:domain.com/123-name-123-nmae.html 新网址:domain.com/name-123-nmae.html

我想要旧的 url 到新的。同一模式有数千个 url,因此我需要使用正则表达式完成重定向。

有正则表达式吗

预先感谢您的回复。

最佳答案

将此代码放入您的 DOCUMENT_ROOT/.htaccess 文件中:

RewriteEngine On

RewriteRule ^[0-9]+-(.+?\.html)$ /$1 [L,NE.R=301]

关于.htaccess - 使用正则表达式的 HtAccess 重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20263500/

相关文章:

css - 使用多个值重写 .htaccess 中的 URL

.htaccess - jquery-mobile 支持的浏览器列表(用于 .htaccess)?

linux - github项目与本地服务器同步问题

php - Zend Framework - 可选的路由器标签

batch-file - 如何将 findstr 的输出重定向到文件?

apache - 如何仅在使用 .htaccess 启用 SSL 的情况下启用目录密码保护?

php - 为 Codeigniter 服务器安装 Bonfire 和安装链接问题

php - Zend Framework 输出渲染顺序

redirect - 使用 webapp 的 web.xml 重定向到登录页面的 SSL

objective-c - NSURLConnection 连接 : didReceiveData: is not called after redirect