简体   繁体   中英

How to redirect old URL from a custom PHP website to new WordPress URL?

I have a client that needs to rebuild their site from custom PHP website to WordPress instalation. The client run a local news site and has tons of news articles in it. Approximately more than 3000 URLs.

The old URL structure look like this:

http://localnewssite.com/news-85720-trump-is-the-king

I need to move them to the new URL like this:

https://localnewssite.com/category-name/article-title

I had two problems in here.

The first one is the old article URL has no category for each of the article, so they just use single "news" category for all of their article URLs and the article's ID number in the database despite their site has 12 news category in it.

The second is I counted approximately more than 3000 articles with that old URL style that I need to move.

I was only given the MySQL database file as the old developer refused to give any access to my clients for their own server.

My client intended to move the site to a new VPS account, so this could be tricky.


Is there any way to use regex or any HTACCESS to automatically and easily redirect 301 all of the old URLs to the new one?

I can't manually move each of the article and reconfigured all of the URL for SEO using Yoast plugin because it would take a lot of time.

Thank you.

您可以使用此插件Redirection ,或者在 htaccess 中编写代码以 301 将旧网址重定向到新网址。

Redirect 301 /old-url https://yourdomain.com/new-url

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM