Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Editing a site in a subdomain WordPress

  • SOLVED

I have installed Wordpress in a subdomain using a URL that is currently hosted elsewhere. I intend to develop a new site and then point the DNS servers at the new site. I can see the subdomain's home page (Hello World!) via mysubdomain.mymaindomain.co.uk but, when I try to go to wp-admin on that URL I end up on the live site. I suspect I need to edit .htaccess but I have no idea what to add or change.

.htaccess currently looks like this:
# BEGIN LSCACHE
## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
<IfModule LiteSpeed>
RewriteEngine on
CacheLookup on
RewriteRule .* - [E=Cache-Control:no-autoflush]
RewriteRule ^min/\w+\.(css|js) - [E=cache-control:no-vary]

### marker CACHE RESOURCE start ###
RewriteRule wp-content/.*/[^/]*(responsive|css|js|dynamic|loader|fonts)\.php - [E=cache-control:max-age=3600]
### marker CACHE RESOURCE end ###

### marker FAVICON start ###
RewriteRule favicon\.ico$ - [E=cache-control:max-age=86400]
### marker FAVICON end ###

</IfModule>
## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
# END LSCACHE
# BEGIN NON_LSCACHE
## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
### marker MINIFY start ###
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} ^(.*)/min/(\w+)\.(css|js)$
RewriteCond %1/wp-content/cache/$2/$1.$2 -f
RewriteRule min/(\w+)\.(css|js) wp-content/cache/$2/$1.$2 [L]
</IfModule>
### marker MINIFY end ###
## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
# END NON_LSCACHE
# BEGIN WordPress

# END WordPress

Answers (2)

2019-07-11

Rempty answers:

Did you updated the database with new url?

find options table and update siteurl and home options

Also you can set the urls adding in wp-config.php
define( 'WP_HOME', 'http://example.com' );
define( 'WP_SITEURL', 'http://example.com' );

if you still having problem you can use wp migrate db and get a database with the url updated.


User183037 comments:

The site has been setup from scratch using Installatron, so the database should be fine. It is just that the URL is live on another server, so I can't access my version using the main URL but only using the subdomain URL which works fine but redirects me to the live URL when I add wp-admin to the end of the subdomain URL. I hope that makes sense!


Rempty comments:

there is nothing in your htaccess to modify all looks fine, you need to check database, try adding in wp-config the 2 lines I provided you.


User183037 comments:

I have added those two lines to wp-config but it hasn't changed the behaviour.

2019-07-11

Monit Jadhav answers:

Add in your wp-config.php file located in the root folder

define( 'WP_HOME', 'http://mysubdomain.mymaindomain.co.uk' );
define( 'WP_SITEURL', 'http://mysubdomain.mymaindomain.co.uk' );

Another option is to edit the WordPress database options table. Screenshot Attached. Generally they have ID 1 & 2 in the options table.

Let me know if you dont know how to do the above steps.

This should fix it though.

Monit