最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to redirect a page to another?

programmeradmin2浏览0评论

On my website, I have following url structure:

example/test/
example/test/a-page
example/test/another-page

How can I redirect all of the URLS that contains /test/ right after the domain name to example/info/

I understand I can do it using htaccess, but I cannot format the rule syntax.

On my website, I have following url structure:

example/test/
example/test/a-page
example/test/another-page

How can I redirect all of the URLS that contains /test/ right after the domain name to example/info/

I understand I can do it using htaccess, but I cannot format the rule syntax.

Share Improve this question asked Aug 6, 2020 at 18:10 heeraheera 132 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Try the following at the top of your .htaccess file, before the existing WordPress directives:

RewriteRule ^test/ /info/ [R=302,L]

The pattern ^test/ matches all URLs that start /test/.

Note that the URL-path matched by the RewriteRule pattern (first argument) does not start with a slash (when used in .htaccess).

If this is intended to be permanent then change the 302 to 301 - but only after you have tested that it works OK.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论