WordPress.org

Ready to get started?Download WordPress

Forums

How to redirect index.htm to new WordPress with same name (12 posts)

  1. fallback2
    Member
    Posted 1 year ago #

    Desperate.

    Replaced old html site with wp in my public_html directory. In other words, WP was a subdirectory, moved it into main slot.

    I can move over single pages through the Redirection plugin & 301 Simple. However, I have been unable to move the main page, the index.htm to my wp opening page!

    My htaccess says: DirectoryIndex index.php index.htm at the top.

    When someone looks for http://main.com/index.htm they come up with a 404, because it comes out as the url: main.commain.com, twice. Is my redirection wrong, or is it the htaccess?

    Please help, been looking for 2 days!!

  2. Pioneer Valley Web Design
    Member
    Posted 1 year ago #

    # custrule
    rewriteengine on
    rewritecond %{HTTP_HOST} ^yourdomain.com$
    rewriterule ^index\.htm(.*)$ "http\:\/\/yourdomain\.com$1" [R=301,L]
    # end custrules

    This goes at the TOP of your .htaccess file and of course you change 'yourdomain' to your domain

    Are you only needing to redirect this page?

    Also, make sure that .htm is listed in your site setup as a default home. (ask your host)

  3. Pioneer Valley Web Design
    Member
    Posted 1 year ago #

    Note also

    DirectoryIndex index.php index.htm

    should be

    DirectoryIndex index.htm index.php

    Yours says use index.php for home (WP does this anyway) but if no index.php use index.htm (you have it reversed)

    From here

  4. Roselienjessie
    Member
    Posted 1 year ago #

    If users have their browsers set to default to showing full URL's, their bookmarks will reflect this full URL. That means if you change file extensions on them, like in this case of moving from html to php, it will break their bookmark. Not good. Fortunately we can fix this.
    To know more about it, try this link http://css-tricks.com/how-to-redirect-indexhtml-to-indexphp/

  5. fallback2
    Member
    Posted 1 year ago #

    Thank you SO MUCH for replying!

    I thought it was reversed, thank you. I have no idea how that happened, since I did not change that at all.

    You are right, I need to redirect all of my pages, not just that one, but they do not show up in htaccess- they all seem to be controlled by Redirection plugin in their own server. However, I think the ones I have changed are working fine. I wrote in another thread asking about if images need to be redirected, too (I'm a cartoonist) and apparently they do, too, so I'll work on them next.

    But that index page is fixed and goes directly to my main site now! Thank you so much! http://donnabarstow.com/

  6. Pioneer Valley Web Design
    Member
    Posted 1 year ago #

    If you create a folder structure for images that is exactly the same as old site, then upload the same images to those folders, you will NOT need a redirect for images.

    if old was mysite.com/image/new/this/image.jpg

    then you create the folder(s) /image/new/this/ and upload image.jpg

    done.

  7. fallback2
    Member
    Posted 1 year ago #

    Thank you so much, Seacoast.

    But I built that html site 12 years ago, and my cartoons have been much improved for online viewing since then. In addition, they were not in a folder, but scattered like pick up sticks all through public html. I had to remove everything to put WP in its place.

    One good thing, from the redirection log I can now finally find out exactly who has been hotlinking to my images, and I am going to give them what for, when I have this new site all in order. Plus they now get a big fat X from the images I took down. :)

  8. Pioneer Valley Web Design
    Member
    Posted 1 year ago #

    There are methods to not allow hot-linking to images.

    http://www.javascriptkit.com/howto/htaccess10.shtml

  9. fallback2
    Member
    Posted 1 year ago #

    Excellent, thank you! I'll have to do this.

    I have also enabled No Right Click plugin, to my mind the most important plugin developed in the 6 years I've had WordPress. I know it's not perfect, but it is really great.

  10. Pioneer Valley Web Design
    Member
    Posted 1 year ago #

    Actually the plugin is useless, any modern browser includes web inspection tools.

  11. fallback2
    Member
    Posted 1 year ago #

    Something is wrong with this htaccess.:(

    Redirection has a log for 404s, and now the Redirection itself is redirecting all my subdirectory pages, etc, on its own (all its own IPs) These hits are not coming from the outside public, but from Redirection, like it's looping itself, and they all begin with my old subdirectory, and have the IP of Redirection itself!

    The 404s are all:
    /oldsubdirectory/newpage/
    instead of:
    /newpage/

    Here is current htaccess:

    DirectoryIndex index.htm index.php
    
    Options +FollowSymlinks
    
    # custrule
    rewriteengine on
    rewritecond %{HTTP_HOST} ^yourdomain.com$
    rewriterule ^index\.htm(.*)$ "http\:\/\/yourdomain\.com$1" [R=301,L]
    # end custrules
    
    # Created by Redirection Module: Apache
    # Mon, 23 Jul 2012 12:56:15 +0000
    # Redirection 2.2.13 - http://urbangiraffe.com/plugins/redirection/
    <Files .htaccess,.svn>
    order allow,deny
    deny from all
    </Files>
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www\.site\.com$ [NC]
    RewriteRule ^(.*)$ http://site.com/$1 [R=301,L]
    </IfModule>
    # End of Redirection
    # 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

    Can one of you htaccess smart people please please help me solve this once and for all? Thanks for any hints at all.

  12. fallback2
    Member
    Posted 1 year ago #

    All of my tags are still directing to my old subdirectory, as logged in Redirection.(I asked about the tags in another post here, but no response yet. I wondered if tags were specifically coded to my old site in my theme somewhere, so I could change that.)

    These 2 404s were also just logged in, which concern me. There were about 50 logs of the wordpress.png. Have no idea what that is.

    http://site.com/new-cartoons/page/5/images/wordpress.png
    http://site.com/site.com_sitemap.xml

    (yes, it is double like this, site.com/site.com )

    In addition, when I just did a backup, it gave me the name of my old subdirectory as the name of the backup: old_wp_1111111.sql.gz

Topic Closed

This topic has been closed to new replies.

About this Topic