subdomain url looks like subdirectory

Community Forums Forums General Discussion subdomain url looks like subdirectory

This topic is: resolved

This topic contains 11 replies, has 3 voices, and was last updated by  Summer 9 months, 1 week ago.

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #66566

    janetskij
    Participant
    Post count: 13

    I set up a sub-domain with my host, set up a directory folder (as I am supposed to do) and installed WP and a Genesis theme into the directory folder and of course, the url looks like a directory url (eg: example.com/subdomain/)

    What I’d like the url to show is this: subdomain.example.com

    If I type in subdomain.example.com in the address bar I am taken to the correct site but the URL doesn’t reflect it.

    I tried changing how the site will appear if different from the original in WP settings but found myself on an infinite loop.

    I’ve been scouring the net for a week now trying to find answers and have only become more confused. I’m not very tecchy as you can see so…

    I don’t know whether to change the .htaccess file (but which one? root or /subdomain/) and put a rewrite in. I found this piece of code;

    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^example.com [NC]
    RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
    RedirectMatch 301 ^/subfolder/(.*)$ http://subdomain.example.com/$1

    Would that work? Would I end up in another infinite loop?

    Or

    What about the multi site option?
    I’ve already installed WP in the subdirectory, how does that change things?
    Would I have to un-install and reinstall? I have already completed some (basic) pages (set up: not to be indexed but live)

    Or

    Is there something else?

    Worst case scenario is that the site has a subdirectory URL, it’s not the end of the world.

    I’ve had great advice from this forum in the past.
    I’m really hoping someone can help.

    The subdomain in question is http://www.english.spellandsound.com (still under development) and is not meant to be a translated or multilingual site.

    http://www.spellandsound.com
    #66640

    pxforti
    Participant
    Post count: 68

    if you add a subdomain like new.mysite.com, when you enter that url, it should look like this: http://new.mysite.com

    If not, then subdomain is not set up correctly. you do not need to modify the .htaccess file to make this happen. Contact your host to determine the problem.


    writeNowDesign
    WordPress and Ecommerce Website Design

    #66749

    janetskij
    Participant
    Post count: 13

    You’re right, I just tried http://new.mysite.com and didn’t work.

    My host said that WP was not configured to show my subdomain as the URL above because WP doesn’t see
    new.mysite.com as the same as
    mysite.com/new

    this is what they wrote;
    The first set of rewrite rules in the file spellandsound/www/english/.htaccess is using /english/ as the RewriteBase. Because the document root for the sub-domain is spellandsound/www/english/, it’ll redirect to spellandsound/www/english/english/, which causes a loop. This suggests to me that you initially configured WordPress for spellandsound.com/english/. You’ll need to correct the WordPress settings.

    How do I configure WP to do this?

    Like I mentioned earlier, I tried to change how the site will appear in the address bar from within the WP dashboard but that put me on a loop.

    Do I need to do something with wp-config file?

    Thanks for your help.

    #66758

    Summer
    Participant
    Post count: 954

    If you put another separate WP installation in that subfolder, when you went to http://english.spellandsound.com you should have been asked to go through the WP installation steps again. You also should have either a second database, or a separate set of prefixes in the same database, whichever way you feel more comfortable with.

    If not, then there may be something wrong with the DNS configuration for your subdomain. If you do it that way, you won’t need rewrites or anything at all, just another WP install in your account.


    #66793

    janetskij
    Participant
    Post count: 13

    Yup, okay, starting to realise how big of an idiot I am…

    I think I put the new WP install into spellandsound.com/english/ so no wonder that what WP is configured to!

    However, I still have a couple of questions;

    1. I recently (3 days ago) connected to Cloudflare on my mainsite and changed my nameservers, so how would this effect any subsequent WP install and my subdomain for that fact? I have spent days trawling through cloudflare knowledge-base articles and I still don’t really understand how it works!
    2. I have already put some pages on the subdomain and about 400 small audio files. I set up a separate database for the new subdomain and wondered if I could use the same database for a new install if the WP database table prefix remains the same in wp-config. file, therefore keeping all of my pages in tact?
    3. Would it be easier to just change the .htaccess file and if so which file (in subdomain folder or root?) and what should it say?

    I really appreciate the help, as you can see, I don’t find any of this intuitive.

    #66847

    Summer
    Participant
    Post count: 954

    Technically, the nameserver change should not affect you, unless you need to manually add “english.spellandsound.com” into the new setup… and based on the DNS error I got on the subdomain last night, you may have to do that.

    If you move your new WP install to the folder that your cPanel associates with “english.spellandsound.com”, and keep the same wp-config info, it should be able to find the site just fine… the one thing you must do is change the siteurl and home entries in your wp_options table… safest way to do that would be with phpMyAdmin, and change those two items to use the http://english.spellandsound.com URL instead of the http://www.spellandsound.com/english/ URL it’s currently trying to use.

    You could leave it in the folder where it is, just make sure your main site doesn’t have a page or post trying to use “english” as a slug… it’ll cause problems.

    Now, is this set up as multisite, or were you asking if you should set it up as multisite? I think it you chose multisite and chose folders instead of subdomains, that’s a slightly different animal to play with…


    #66932

    janetskij
    Participant
    Post count: 13

    It all seems simple when you explain it, but somehow I’ve got myself in another mess!

    Okay, I tried another install of WP into the english folder and nothing changed. I didn’t get the install screen for english.spellandsound.com so I think it’s still configured to the old setting spellandsound.com/english

    but I changed the phpMyAdmin settings as you suggested and added the subdomain to cloudflare so now the site is visible but the one menu item doesn’t work. It says there is an internal server error (configuration issue I’m guessing) but I can’t find out what the problem is yet until my error logs update.

    I can log into english.spellandsound.com and access the dashboard but pages other than home page are returning an Internal server error here even though the permalinks has changed to the right url.

    Is this a tables issue?

    And thinking about it, I didn’t get rid of the WP already installed in spellandsound.com/english before I did the new install which has to go into the same folder. This probably caused the first issue but I don’t know.

    Should I delete the install and start again?

    I’m pulling my hair out here. Please help.

    #66943

    Summer
    Participant
    Post count: 954

    are you using a different database for the english install, or did you use the same database and just changed the table prefix? and what folder is your cPanel pointing english.spellandsound.com to?

    What I’d do is go into phpMyAdmin and drop all tables for the database that english is using, and start all over since you don’t have any real data there yet. Then I’d update cPanel to put your install in a top level folder called english or english.spellandsound.com, and move the contents of the /english subfolder there, then remove the /english subfolder.

    BUT — if you do wipe the english subdir install, and reinstall, make sure you aren’t wiping out the database for your main site. That would be bad :)


    #66946

    janetskij
    Participant
    Post count: 13

    I used a different database for the english set up (not just table prefix of the main data base) and I don’t know how you can find out “what folder is your cPanel pointing english.spellandsound.com to?”

    I had queried with my host, the placement of the directory folder within my files specifically for the subdomain and they said it’s in the right place.

    I’m thinking I might wipe the WP files/folders from the english directory and try a re-install. The database for the subdomain is already in place. I’m hoping things will set up okay.

    What do you think? reckon it’ll work?

    #66950

    Summer
    Participant
    Post count: 954

    The fastest way to do a reinstall with the english database is to empty out the database… WP will see an empty db and restart the installation questions. You shouldn’t have to replace the WP files at all…. it’s the funky config in the database you need to clear out of there to start fresh.

    When you set up the subdomain on your host, how did you do it? Typically with cPanel, when you first set up the subdomain, it uses a default folder name so it’ll know where the files for that site are. Plesk and other hosting control panels do something similar, but levels of configurability for that folder name may vary greatly, depending on hosts.

    Yes, my decades as a unix sysadmin in a previous life/career turn are showing. :)


    #66969

    janetskij
    Participant
    Post count: 13

    Alrighty then!

    I couldn’t clear the database, so I deleted it and created a new one with a different name. I inserted this new database name into the wp-config. file within the spellandsound.com/english directory and then went to url: english.spellandsound.com where I was asked to complete the install.

    Yeah!!!!!

    I backed up my text in a text editor and I’ll have to re-do a few fiddly pages, but everything is where it should be, without having to rewrite my .htaccess file.

    You’re a genius!

    I plan on creating a few more sub-domains and let me tell you this….

    I won’t be making these mistakes again!

    By the way, I checked out your site and it looks quite interesting. I’ve bookmarked it for future reference (if I can ever get past the beginners stage).

    Thanks again.

    #67050

    Summer
    Participant
    Post count: 954

    Glad it worked for you!

    I’m hoping to add http://www.genesisthemesguide.com to that official list of projects soon, after I add in and configure the user reviews… been trying to steal time for that in between supporting existing clients and looking for new paying projects :)


Viewing 12 posts - 1 through 12 (of 12 total)

The topic ‘subdomain url looks like subdirectory’ is closed to new replies.