WordPress.org

Ready to get started?Download WordPress

Forums

.htaccess help (2 posts)

  1. Danny159
    Member
    Posted 2 years ago #

    Hi All,

    I have a WordPress installation at the following:

    http://www.domain.com/wordpress/

    However I need some help...
    When a use goes to http://www.domain.com I want it to redirect to http://www.domain.com/wordpress/ however I want to hide the /wordpress/ so the user only sees http://www.domain.com

    But it still needs to work with links such as
    http://www.domain.com/wordpress/2012/05/pagetitle/

    Can anyone help me if it can even be done!

    Dan

  2. I have a WordPress installation at the following:

    http://www.domain.com/wordpress/

    Good.

    When a use goes to http://www.domain.com I want it to redirect to http://www.domain.com/wordpress/

    That's easy to do. Just a little .htaccess entry and you're all set.

    however I want to hide the /wordpress/ so the user only sees http://www.domain.com

    Huh? Now that's tricky and not really worth the effort.

    You can move WordPress but hiding that like that isn't really practical. Also I don't know how to do that. ;)

    Backup the whole works, all your files and database and put that somewhere safe. This is your safety net.

    http://codex.wordpress.org/WordPress_Backups
    http://codex.wordpress.org/Backing_Up_Your_Database
    http://codex.wordpress.org/Restoring_Your_Database_From_Backup

    Now give this a read.

    http://codex.wordpress.org/Moving_WordPress

    If there is no website or files at your / directory then extract the WordPress files into that directory. I am assuming you are using the current 3.3.2 version.

    http://wordpress.org/latest.zip

    You directories (not files) there will look like this.

    /
    /wordpress
    /wp-content
    /wp-includes
    /wp-admin

    Copy all of the /wordpress/wp-content files and directory into /wp-content. Don't move them, just copy them.

    Copy /wordpress/wp-config.php into /wp-config.php.

    Now visit http://www.domain.com/wordpress/wp-admin/options-general.php and change the WordPress Address (URL) and Site Address (URL) to both be http://www.domain.com (less the /wordpress part) and save that.

    Visit http://www.domain.com/wp-admin/options-permalink.php and re-save your permarlinks.

    In your /wordpress directory rename the old .htaccess file to .htaccess-old. Create a new /wordpress/.htaccess file and put these lines in it.

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule (.*) http://www.domain.com/$1 [R=301,L]
    </IfModule>

    That will handle your old URLs.

    The last thing is to use a search and replace to find all references of http://www.domain.com/wordpress to http://www.domain.com.

    Try this plugin for search and replace.

    http://wordpress.org/extend/plugins/safe-search-replace/

    Of you you are comfortable with it and can follow the instructions, this is a really good one too. It's not a plugin but it's easy to use, just delete it once you are done.

    http://interconnectit.com/124/search-and-replace-for-wordpress-databases/

    And if anything really goes wrong, just restore the files and database. That will put you back to square one.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags