我如何将Laravel 7散装旧URL重定向到新URL? 4000+旧网址

发布于 2025-02-06 19:53:38 字数 558 浏览 3 评论 0原文

我想将旧URL重定向到新的URL

旧URL: http://example.com/productame.com/productsite-reviews

new url: http://example.com/reviews/reviews/productsite.com

问题我有超过4000多个URL。我们可以在没有.htaccess文件的情况下将旧URL重定向到新URL吗?

这是我的家路由

路由:: get('/','homecontroller') - > name('home');

是否有任何方法可以在不编写HTACCESS代码的情况下重定向这些URL?

I want to redirect my Old URL to New URL

OLD URL : http://example.com/productsite-reviews

New URL : http://example.com/reviews/productsite.com

The problem is i have more than 4000+ URLS. Can we redirect the old URL to New URL without .htaccess file ?

this is my home route

Route::get('/', 'HomeController')->name( 'home' );

Is there any way to redirect these URL in bulk without writing htaccess code?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

奢欲 2025-02-13 19:53:38

首先,使用将当前路线更改为新控制器

Route::get('/', function () {
 return redirect('/reviews/productsite.com');
  });

,然后将当前路线重定向

Route::get('/reviews/productsite.com', 'HomeController')->name( 'home' );

First of all, redirect it to new controller using

Route::get('/', function () {
 return redirect('/reviews/productsite.com');
  });

And then change the current route to

Route::get('/reviews/productsite.com', 'HomeController')->name( 'home' );
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文