Why is my subdomain redirecting to my www?

coherent

Registered
Sep 16, 2020
2
1
3
Chicago
cPanel Access Level
Root Administrator
Hi there,
I am trying to create a staging Wordpress server that is a copy of an existing site I have running on the root and www domain. I created a new sub-domain staging.mysite.com and I can see in my domain registrar that I have a staging A record that is indeed pointing at my server.

The problem is when I actually go to the site. I get a 301 redirect when I go to staging.mysite.com that redirects to www.mysite.com. When I go to cpanel though I have no redirects on the redirects page and on the subdomains page, it says that my staging.mydomain.com does not have any redirects.

How I copied the site was download a zip of my current website and do a find and replace for all www.mydomain.com and replace it with staging.mydomain.com. These changes were all almost exclusively in the .htaccess file. Here's an example of what the .htaccess looks like:

```
# BEGIN WordPress
# The directives (lines) between `BEGIN WordPress` and `END WordPress` are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

RedirectPermanent /about/press/ http://staging.mysite.info/sitemap
# there are hundreds of more redirects like this for every page on the site, all of them were updated to staging.
```

Any things to double check? I can't tell if this is a configuration with some kind of access file in the site folder or if there is a configuration parameter with cpanel.

Thank you!
 

andrew.n

Well-Known Member
Jun 9, 2020
240
51
28
EU
cPanel Access Level
Root Administrator
Also re-write the URL in the WP database. If you go to general settings you will see that WP also stores the domain inside it's db. If you copy the site that needs to be changed as well.