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

redirect - How to add new redirection on wordpress site

programmeradmin1浏览0评论

I have created new website / and I have one old site /. We have a customer support ticket portal and that portal URL is /. Now I have changed the support portal URL into / Now I want to add redirection for following conditions on .htaccess.

  1. Redirect / to /
  2. Redirect into
  3. Redirect into

How can I achieve this anyone knows the solution for this one?

I have created new website https://example1/ and I have one old site https://example/. We have a customer support ticket portal and that portal URL is https://support.example/. Now I have changed the support portal URL into https://support.example1/ Now I want to add redirection for following conditions on .htaccess.

  1. Redirect https://support.example/ to https://support.example1/
  2. Redirect https://support.example/a/ticket/124 into https://support.example1/a/ticket/124
  3. Redirect https://support.example/ticket/124 into https://support.example1/ticket/124

How can I achieve this anyone knows the solution for this one?

Share Improve this question edited Oct 11, 2019 at 9:29 developerme asked Oct 11, 2019 at 8:32 developermedeveloperme 1415 silver badges18 bronze badges 5
  • To clarify, you only want to redirect the support subdomain on HTTP only? You don't want to redirect the domain apex (your new site) and you don't wish to redirect to HTTPS? – MrWhite Commented Oct 11, 2019 at 9:22
  • @MrWhite want to redirect into https i just given the example – developerme Commented Oct 11, 2019 at 9:28
  • @MrWhite i edited my question – developerme Commented Oct 11, 2019 at 9:29
  • You only want those 3 URLs redirected? And the support subdomain also points to your wp installation (is this also handled by wp)? – MrWhite Commented Oct 11, 2019 at 9:53
  • The 2nd and 3rd are example there will be ticket number will change there is lot of tickets we need to redirect that for all tickets for 2nd and 3rd – developerme Commented Oct 11, 2019 at 9:55
Add a comment  | 

1 Answer 1

Reset to default 1

To redirect just those 3 URLs (with variable ticket number) on the support subdomain then you can do something like the following before the WordPress front-controller (assuming the support subdomain resolves to the same place and is probably handled by WP) using mod_rewrite, in the root .htaccess file:

RewriteCond %{HTTP_HOST} ^support\.example\ [NC]
RewriteRule ^((?:a/)?ticket/\d+)?$ https://support.example1/$0 [R=302,L]

Change to a 301 (permanent) redirect only when you are sure it's working OK.

Note that this doesn't specifically redirect HTTP to HTTPS.

发布评论

评论列表(0)

  1. 暂无评论