PluggedP93

Member
Dec 4, 2019
20
3
3
Canada
cPanel Access Level
Website Owner
My company has set up, many years ago, a wildcard for our website, so that anything.domain.com always points back to our site. Unfortunately, this is causing some of those urls to show up in Google searches. We came across this article: SEO Friendly Wildcard DNS Set Up for Apache, IIS, Nginx - StepForth Web Marketing Inc.

After trying to set up the redirects that are mentioned there, we have yet to find a working solution. I've tried setting this up in a few different .htaccess files (at /home/user, /home/user/public_html and /home/user/public_html/domain), none of which seem to work. I do however have regular redirects set up for some specific pages at /home/user/public_html/domain which do work. I am at a loss.

Does anyone have any suggestions for this?

Thanks!
 
Last edited by a moderator:

PluggedP93

Member
Dec 4, 2019
20
3
3
Canada
cPanel Access Level
Website Owner
This is the rule that was tried from the article:


Code:
RewriteEngine on
RewriteBase /

#for all requests on xyzname.com
RewriteCond %{HTTP_HOST} xyzname\.com$ [NC]
#if they are not for the www.xyzname.com
RewriteCond %{HTTP_HOST} !^www\.xyzname\.com$ [NC]
#301 redirect to www.xyzname.com
RewriteRule (.*) http://www.xyzname.com/$1 [R=301,L]
 
  • Like
Reactions: cPanelLauren

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,297
1,259
313
Houston