We are launching a new product with a vanity domain that’s easier to remember, but we want to have it direct to the proper place on our web site. I’ve created a separate virtual server on the site – we’ll call that wpredirect.abc.com – and under that domain are multiple vanity/landing domains that will be used to get the word out.
and we want those to redirect to:
and that’s easy with a simple setup:
Source URL path: / Destination: https://tech-minded.com/smart-spacers/
The problem is that I’d like for the redirect to also handle trailing slashes, as well as further extensions to the URL. For example:
https://SmartSpacerDividers.com https://SmartSpacerDividers.com/ https://SmartSpacerDividers.com?ref=helloworld https://SmartSpacerDividers.com/?ref=helloworld https://SmartSpacerDividers.com/faq?ref=helloworld https://SmartSpacerDividers.com/faq/?ref=helloworld
would go to, respectively:
https://tech-minded.com/smart-spacers https://tech-minded.com/smart-spacers/ https://tech-minded.com/smart-spacers?ref=helloworld https://tech-minded.com/smart-spacers/?ref=helloworld https://tech-minded.com/smart-spacers/faq?ref=helloworld https://tech-minded.com/smart-spacers/faq/?ref=helloworld
Furthermore, for that to work with and without the www, as well as HTTP versions.
I’m struggling with the regex for this, and can’t seem to get it figured out. The closest I get is the straight / redirecting, but that makes these not work quite right because of trailing spaces. Here’s what I found:
Source URL: ttps://smartspacerdividers.com/ Became Target URL: https://tech-minded.com/smart-spacers/ Source URL: https://smartspacerdividers.com Became Target URL: https://tech-minded.com/smart-spacers/
Added path does NOT work:
Source URL: https://smartspacerdividers.com/faq Became Target URL: https://tech-minded.com/smart-spacers/ Source URL: https://smartspacerdividers.com/faq/ Became Target URL: https://tech-minded.com/smart-spacers/
Parameters work, but incorrect trailing slash:
Source URL: https://smartspacerdividers.com?ref=helloworld Became Target URL: https://tech-minded.com/smart-spacers/?ref=helloworld/ Source URL: https://smartspacerdividers.com/?ref=helloworld Became Target URL: https://tech-minded.com/smart-spacers/?ref=helloworld/
Any ideas on the right regex pattern to match and replace?