1

My client have a site : business.com

All the files of the old fashion site is there, images, video, html, css. i just made a folder called business.com/cms and installed wordpress here. FOr 2 month they write stuff, upload images and do there site in wp. Now it's time to lunch the site

The problem, all the images and page belong to business.com/cms not the root business.com. when i will remove the old site and put all the file from the cms folder at the root level, the site will miss a lot of thing, images and manually link pdf in text

How do you do that properly. Is itst possible to keep the site in /cms and used some .htaccess wizardry to make it look like root ?

HELP, need to lunch tomorrow !

3 Answers 3

2

Your easiest solution here is to keep everything in your cms folder.

and follow this step found at http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

This will keep all wordpress related files in the cms folder, but it will look like its running from the root, copy of index and some .htaccess wizardly as you call it :). enjoy

Using a pre-existing subdirectory install

If you already have WordPress installed in its own folder (i.e. http://example.com/wordpress) then the steps are as follows:

  • Go to the Generalpanel.
  • In the box for Site address (URL): change the address to the root directory's URL. Example: http://example.com
  • Click Save Changes. (Do not worry about the error message and do not try to see your blog at this point! You will probably get a message about file not found.)
  • Copy (NOT MOVE!) the index.php and .htaccess files from the WordPress directory into the root directory of your site (Blog address). The .htaccess file is invisible, so you may have to set your FTP client to show hidden files. If you are not using pretty permalinks, then you may not have a .htaccess file. If you are running WordPress on a Windows (IIS) server and are using pretty permalinks, you'll have a web.config rather than a .htaccess file in your WordPress directory. As stated above, copy (don't move) the index.php file to your root directory, but MOVE (DON'T COPY) the web.config file to your root directory.
  • Open your root directory's index.php file in a text editor
  • Change the following and save the file. Change the line that says:
    require('./wp-blog-header.php');
    to the following, using your directory name for the WordPress core files:
    require('./wordpress/wp-blog-header.php');
  • Login to your site. It should still be http://example.com/wordpress/wp-admin/
  • If you have set up Permalinks, go to the Permalinks panel and update your Permalink structure. WordPress will automatically update your .htaccess file if it has the appropriate file permissions. If WordPress can't write to your .htaccess file, it will display the new rewrite rules to you, which you should manually copy into your .htaccess file (in the same directory as the main index.php file.)
  • 4
    • How does this procedure affect wordpress updating in the futur ?
      – menardmam
      Aug 8, 2012 at 15:56
    • how do you mean? It just works as continued. Everything wordpress related stays in the folder, but all urls look like from root. Also when updating and adding new posts etc. I have all my wordpress websites like this just to keep things organised.
      – woony
      Aug 8, 2012 at 18:12
    • OK, nice it work for almost ALL but the root, instead of displaying the index.php "normal" page, it display : The page you were looking for is no longer available. because the index.php still send to the /cms page, that does not exist in the database of wp
      – menardmam
      Aug 8, 2012 at 20:44
    • did you change this bit: Change the following and save the file. Change the line that says: require('./wp-blog-header.php'); to the following, using your directory name for the WordPress core files: require('./wordpress/wp-blog-header.php');
      – woony
      Aug 9, 2012 at 7:20
    0

    In Settings > General change WordPress Address (URL) to http://business.com/cms and Site Address (URL) to http://business.com.

    The index.php file in root (not in cms/ directory)

    <?php
    /**
     * Front to the WordPress application. This file doesn't do anything, but loads
     * wp-blog-header.php which does and tells WordPress to load the theme.
     *
     * @package WordPress
     */
    
    /**
     * Tells WordPress to load the WordPress theme and output it.
     *
     * @var bool
     */
    define('WP_USE_THEMES', true);
    
    /** Loads the WordPress Environment and Template */
    require('./cms/wp-blog-header.php');
    

    Then move cms/config.php in the root to config.php. And also move .htaccess from cms/ directory to root.

    Find the following lines if exist

    RewriteBase /cms/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /cms/index.php [L]
    

    and remove cms/ string so you end up with the following

    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    

    Let me know if something went wrong.

    2
    • How does this procedure affect wordpress updating in the futur ?
      – menardmam
      Aug 8, 2012 at 16:01
    • It doesn't, everything will work as expected, except when you want WordPress multisite. Aug 8, 2012 at 17:41
    0

    Wait...is it just me or no one thought suggesting a find & replace in the database might have fixed his problem..??

    Find business.com/cms/ & replace it with "/" or "business.com"

    And obviously moving the files from subfolder cms to the public_html...

    All could have been done via ssh in seconds...

    1
    • Some URLs are stored in serialized arrays. A simple replace would break those data completely.
      – fuxia
      Aug 22, 2012 at 4:36

    Your Answer

    By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

    Not the answer you're looking for? Browse other questions tagged or ask your own question.