• I have built a new WordPress site which I am waiting to make live, the old Dreamweaver site is still active at the moment.
    This is the existing (old) site http://www.idc-canaryislands.com and this is the new WP site http://www.idc-canaryislands.com/wp

    My problem is I don´t know how to get rid of the existing site and replace it with the new WP one. I asked my server provider who gave me some instructions that I did not understand, it was to do with the .htaccess file. I managed to open this file but there is nothing inside and I don´t know what to add.
    At the moment my existing site is within the public_html folder but also the new WP site is in a folder called wp, within the public-html folder.

    Can anyone help please, I need step by step instructions as I am not a web designer. I have access to the cpanel on my server, I can upload and move files within Dreamweaver and I have filezilla. Thank you Yvonne

Viewing 15 replies - 1 through 15 (of 15 total)
  • You can do what you want without moving any files. You can simply edit your database to remove the /wp and then use .htaccess in public_html to redirect ‘http://www.idc-canaryislands.com’ to the sub-folder. Take a look here and see what you think:
    https://ww.wp.xz.cn/support/topic/remove-wp-subdirectory-from-short-link-url?replies=4#post-7320440

    Before doing that, it would be a good idea to look at your current htaccess closely to see whether you should move it into the sub-folder and make any necessary edits if there is anything there related to security or caching.

    Thread Starter YvonneTaylor

    (@yvonnetaylor)

    Thank you for your reply.
    I clicked on the link but unfortunately I do not understand any of the text highlighted in blue. When I open the .htaccess file it looks empty there is no text to change.
    I did not create the .htaccess file someone else did it for me so I do not know what edits to make?

    Thread Starter YvonneTaylor

    (@yvonnetaylor)

    I have found the following link
    https://codex.ww.wp.xz.cn/Giving_WordPress_Its_Own_Directory

    If I followed the instructions for the Use a Pre existing sub directory install, do you think it would work as I can see my new site if I go to http://www.idc-canaryislands.com/wp
    Many thanks

    I clicked on the link but unfortunately I do not understand any of the text highlighted in blue.

    Any line preceded by # is a comment, and any line that does not begin with # is code. With comment lines removed, here is the edited version you would need:

    # .htaccess for idc-canaryislands.com redirect to /wp/
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^(www.)?idc-canaryislands.com$
    RewriteCond %{REQUEST_URI} !^/wp/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /wp/$1
    RewriteCond %{HTTP_HOST} ^(www.)?idc-canaryislands.com$
    ## index.html for default
    #RewriteRule ^(/)?$ wp/index.html [L]
    ## index.php for WordPress
    RewriteRule ^(/)?$ wp/index.php [L]

    When I open the .htaccess file it looks empty there is no text to change.
    I did not create the .htaccess file someone else did it for me so I do not know what edits to make?

    If someone just made an empty .htaccess file, all you would need to do for this part would be to copy the above into it and save it.

    I have found the following link
    https://codex.ww.wp.xz.cn/Giving_WordPress_Its_Own_Directory

    I have never tried doing things that way because what I have suggested has been much simpler for me. You might or might not also need to later edit some additional links in your database, but you should (or at least might) be able to go to Dashboard > Settings > General and place http://www.idc-canaryislands.com in both boxes there and then put the above .htaccess in place and be finished.

    edit: If you try the above precisely and more work is still needed, I will keep posting right here until you get it fixed.

    Thread Starter YvonneTaylor

    (@yvonnetaylor)

    Thank you for the easy to follow instructions.
    Ok, almost there, now when I put in http://www.idc-canaryislands.com it points to the new site but the index page is missing http://www.idc-canaryislands.com/wp/index.php/en/ also my WP admin bar is showing.
    All the other menu items work okay, it is just the index page (for each language)that is missing.
    When you click on Home from the menu it goes to idc-canaryislands.com/wp
    The other I noticed is that if I click (eg) on About Us then remove the about us part of the title and press enter it opens the index page but none of the feature column links are found.
    Just to confirm the last part of your instructions, you said ¨put the above .htaccess in place¨, I have moved it into the WP folder which is within the public_html. The original .htaccess file is still in the original place.
    Many thanks Yvonne

    Just to confirm the last part of your instructions, you said ¨put the above .htaccess in place¨, I have moved it into the WP folder which is within the public_html. The original .htaccess file is still in the original place.

    No. This is what needs to be in /public/html/wp/.htaccess:

    # BEGIN WordPress
    <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

    Or, just have nothing at all there and then *later* go to Dashboard > Settings > Permalinks and WordPress will write it. The .htaccess I had posted must *first* go in as /public_html/.htaccess to redirect ‘idc-canaryislands.com’ to its /wp/ sub-folder destination. To explain:

    cPanel has your domain assigned to /public_html/ and you likely cannot change that. So, the custom htaccess in public_html will send your domain to /wp/ where WordPress will then be found and respond without ever even knowing it is in a sub-folder and your browser will only use ‘http://www.idc-canaryislands.com&#8217; to get there.

    Thread Starter YvonneTaylor

    (@yvonnetaylor)

    Oh dear, now I have a bigger problem, I cannot access the WordPress dashboard anymore, before it was http://www.idc-canaryislands.com/wp/wp-admin it comes up 404 error.
    What do I do now?
    Thank you

    There is a line of code your can temporarily place near the bottom of wp-config.php that I believe might fix that:

    /**
    * WordPress supports an automatic relocation method intended as quick assist
    * for getting a site working after relocating it from one server to another.
    * After the "define" statements and just before "That's all, stop editing!",
    insert a new line, and type: /*toggle on/off*
    define('RELOCATE',true);
    /* Next Login as normal after being certain of the address being sent from your browser.
    * Then look again in your browser's address bar to verify that you have logged in at the correct server.
    * If this is the case, next go to Dashboard > Settings > General and verify the address settings and save them.
    * Once the above has been completed, either remove the above 'define('RELOCATE',true);' line or
    * comment it out with '//' or change the 'true' value to 'false'.
    * Note: When the RELOCATE flag is set to 'true', the Site URL will be automatically
    * updated to whatever path is being used to access the login screen. This will get the admin
    * section up and running on the new URL, but it will not correct any other part of the setup.
    * Those will still need to be altered manually.
    /**
    * That's all, stop editing! Happy blogging. */

    To activate that single line, just add a slash after the /*toggle on/off* just above it so you will have this: /*toggle on/off*/ .

    Before doing that, however, be certain tp clear your browser cache and then only go to this link: ‘http://www.idc-canaryislands.com/wp-admin/index.php&#8217; . I have only ever used that code a couple of times, so I caution you to be careful with it since I do not know how it works.

    Thread Starter YvonneTaylor

    (@yvonnetaylor)

    Just one question before I put in this code, am I also adding on the same line
    define(‘RELOCATE’,true);
    Many thanks
    Yvonne

    The define('RELOCATE',true); line is the only line you actually need at all. The remainder of what I had posted is simply all the related commenting. Then after you have things straight, go back and either remove that line or else change it to define('RELOCATE',false); .

    Thread Starter YvonneTaylor

    (@yvonnetaylor)

    In your previous email you put:
    To activate that single line, just add a slash after the /*toggle on/off* just above it so you will have this: /*toggle on/off*/
    There is no toggle on/off unless I add this as well before the Define etc etc.

    This is what is there at the moment:
    define(‘WP_DEBUG’, false);

    /* That’s all, stop editing! Happy blogging. */

    I am sorry for all this trouble. Many thanks

    The /*toggle on/off*/ line is just something I use to turn the next line on or off as a comment by using just one character, and I apologize for not being more clear there.

    Here is what you need:

    define('WP_DEBUG', false);
    define('RELOCATE',true);
    
    /* That's all, stop editing! Happy blogging. */

    note: Be certain to have your browser cache clear so it will hopefully not redirect you and then be sure to *not* include the /wp/ or whatever when you go to your login after adding that code.

    Thread Starter YvonneTaylor

    (@yvonnetaylor)

    It still comes up with page not found 404.

    I added define(‘RELOCATE’,true); in the correct place, I cleared the browser cache again and then I used the link in the previous message, which was

    and then only go to this link: ‘http://www.idc-canaryislands.com/wp-admin/index.php&#8217; It does not try to redirect it just says page not found on this server.
    Yvonne

    note: If you have not already done so, you should now either remove ('RELOCATE',true); from wp-config or else change it to ('RELOCATE',false); .

    Doing what you have done so far is part of eliminating possibilities (troubleshooting), and I do not know exactly what to suggest…

    https://www.google.com/search?q=wp-admin+not+found+on+this+server

    You are using /public_html/.htaccess to redirect your domain URL to /public_html/wp/, and then you have /public_html/wp/.htaccess for you actual WordPress installation. I doubt this will help, but you might try deleting the .htaccess in /public_html/wp/ to see whether that makes any difference. If it does, you should then be able to go to Dashboard > Settings > Permalinks where WordPress will write that .htaccess for you.

    At this point, I would try looking in the database for some of the things ‘songdogtech’ mentions later in this thread:

    https://ww.wp.xz.cn/support/topic/the-requested-url-login-was-not-found-on-this-server-1

    And/or/also: Use phpMyAdmin to search you database for any instance of ‘idc-canaryislands.com/wp’ since that is part of both the old URL and the idc-canaryislands.com/wp-admin you now need to use. Just be careful about what you might do with any find/s you might make there…and be sure to have a fresh database backup alongside any previous one prior to making any changes.

    Thread Starter YvonneTaylor

    (@yvonnetaylor)

    I must apologise for the delay in responding to your last message, this project is not my main job.
    Just to let you know that everything is working well now. I re traced my steps with your information, manually changed the browser to access the Dashboard and then changed all the links internally to point at the correct location, voila, everything works well.

    Many thanks for all your assistance, it is much appreciated.

Viewing 15 replies - 1 through 15 (of 15 total)

The topic ‘WordPress is in the wrong folder on the server’ is closed to new replies.