【问题标题】:301 htaccess redirect for old urls to new urls301 htaccess 将旧网址重定向到新网址
【发布时间】:2016-07-18 09:28:58
【问题描述】:

我想移动所有具有这种结构的 URL

domain.com/public/index.php/site/samepagename

domain.com/site/samepagename

谁能帮助我.htaccess

这不是我上一期的重复。这是新的。

【问题讨论】:

标签: apache .htaccess redirect


【解决方案1】:

您可以创建 .htaccess 文件并添加以下行:

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^public/index.php/([a-zA-Z0-9-]+)$ site/$1

Options +FollowSymlinks
RewriteEngine on
rewriterule ^public/index.php/samepagename(.*)$ http://domain.com/site/samepagename$1 [r=301,nc]

请注意,以上内容未经测试。在部署到生产环境之前,请在本地进行测试。

【讨论】:

  • 不工作..我也更新了实际的网址...旧网址中缺少一个目录
  • 你的服务器支持 mod_rewrite 吗?
  • 500 内部服务器错误 这也是一个 laravel 网站,所以我有两个 htaccess 一个在 public 文件夹中,一个在 public_html 文件夹中......还有一件事是 url 像这样 mydomain.com/site/mypagename .com 或 .net 或 .xys 等
猜你喜欢
  • 2013-10-16
  • 2016-09-01
  • 1970-01-01
  • 1970-01-01
  • 2021-06-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-05-19
相关资源
最近更新 更多