First of all, I would like to state that I came here because I spent the whole weekend not to disturb anyone about this subject, changed 3 hosting companies, re-installed the site, and finally admitted that I was helpless. I made all this effort to learn something on my own, although I learned a lot, but I could not achieve exactly what I wanted. Thanks in advance to anyone who might be willing to help me.
First of all, I should mention that I have 2 domain names. (I have more but the first 2 are relevant to our topic)
domain1: Connected with Cloudflare. My main domain and provided by a hosting company. WordPress installation is installed, I have no problems.
domain2 : Purchased from hosting1. Connected with Cloudflare. Not on any hosting platform. The bare domain name.
My purpose and goal:
Simply this; When a user wants to go to domain1/category/lifestyle, they will automatically go to domain2/category/lifestyle and see domain2/* in the browser url line.
But it is not that simple. Because my landing page is domain1. In order to perform the above operation, the user must click on the lifestyle tab that I set in the header menu. So if the user is not redirected from google search, he will not type the url by hand. He will click domain1/category/lifestyle with the mouse. Or click on one of the posts under the lifestyle category (WordPress category) on the homepage and go to domain1/lifestyle/*particular lifestyle related post.
To achieve this goal, I have linked both domains to Cloudflare. Under domain1(Cloudflare), I set Rules and Forwarding URL. The operation I did is: url required → h t t p s : //domain1//lifestyle/ → forwarding URL 301 → destination URL → h t t p s : //domain2/lifestyle//
Isn’t this supposed to do what I expect above (It doesn’t)
Then again, I went to the Bulk Redirects section under Cloudflare. To Create Bulk Redirect List – >
Source Url: I wrote h t t p s : domain1/category/lifestyle
I wrote the target url part: h t t p s : domain2/category/lifestyle
Because the user can go directly to the /lifestlye path (by clicking the post directly)
source h t t p s : domain1/lifestyle
target h t t p s : domain2/lifestyle
This process has worked before (on Godaddy). It doesn’t work on my current hosting service. So when I click domain1/lifestyle or /category/lifestyle, the browser url does not change to domain2. (Yes, I am refreshing the browser cache)
But when I manually type domain2/lifestyle’, I can see that the browser url remains domain2. Yet if I click on another lifestlye related post on this page, the url changes to domain1.
I don’t want to use redirecton as wordpress plugin. Because it only supports sending site root to another site root. Not sub folders.
Also, we must remember that domain2 is not an installatin. It’s just a domain name! (Not backed by any host)