Forums

Trying to do a 301 redirect in .htaccess for my wordpress blog in a sub-directoy (12 posts)

  1. bugzbrian2
    Member
    Posted 1 year ago #

    Hello,

    I am trying to do a 301 redirect in .htaccess for my wordpress sitemap.xml. My blog is located in a separate folder (directory) within my primary domain. Any suggestions on what changes to make in my wordpress .htaccess file to do a redirect for url's. I am primarily concerned with doing a redirect for http:// reynoldspest.com/ reynoldsblog/sitemap.xml to http:// http://www.reynoldspest.com/ reynoldsblog/sitemap.xml. This is what my current .htaccess file looks like:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /reynoldsblog/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /reynoldsblog/index.php [L]
    </IfModule>

    # END WordPress

  2. You want to redirect NON www to http://WWW.yoursite?

    For everything or JUST the sitemap?

  3. bugzbrian2
    Member
    Posted 1 year ago #

    I am only having trouble with some (not all) non "WWW" in my blog converting to "WWW" i.e. http://reynoldspest.com/reynoldsblog/sitemap.xml. I have been unsuccessful in my attempts to redirect this url and some others.

    I am sure there is code for .htaccess to help me, but I do not know what to do.

    Thanks

  4. Yeah I get that. What I'm asking is if you want ALL of your http://reynoldspest.com/ URLs to look like http://www.reynoldspest.com/ or http://reynoldspest.com/ :)

    Because I have an answer, and it's different depending on YOUR answer. So. All the URLs should have www or ONLY the sitemap.xml?

  5. bugzbrian2
    Member
    Posted 1 year ago #

    Yes, they all should be WWW

    Thank you

  6. That's easiest of all! :)

    Put this code in your .htaccess ABOVE your WordPress section:

    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^www.reynoldspest.com$
    RewriteRule ^(.*)$ http://www.reynoldspest.com/$1 [R=301]
  7. bugzbrian2
    Member
    Posted 1 year ago #

    I have that code in my other .htaccess in the root directory for my main site. I tried putting it in my reynoldsblog .htaccess but it does not work. :-(

  8. Do you have your URLs within wordPress set to use www?

  9. bugzbrian2
    Member
    Posted 1 year ago #

    Yes-I changed them about a week ago and they all redirect except the http://reynoldspest.com/reynoldsblog/sitemap.xml. I also tried to implement some 301's for some navigation pages that I deleted, and was unable.

  10. Yes-I changed them about a week ago and they all redirect except the http://reynoldspest.com/reynoldsblog/sitemap.xml

    That's a plugin, right? Turn it off and back on.

    I also tried to implement some 301's for some navigation pages that I deleted, and was unable.

    Okay NOW it sounds like your .htaccess isn't being read correctly. Ask your host for some help on it. Tell them, specifically, that .htaccess isn't being processed.

  11. bugzbrian2
    Member
    Posted 1 year ago #

    I will call them and see what is going on. I'll let you know.

  12. bugzbrian2
    Member
    Posted 1 year ago #

    I spoke with HostGator and after about an hour of waiting for a solution and explaining about what was happening, I was finally told that since I notified Google about where my sitemap was now located that I would be okay and that there was no more that I could do. In a nutshell,these changes including the navigation pages that I deleted cannot be redirected.

    Thanks for your help though,

    BugzBrian

Topic Closed

This topic has been closed to new replies.

About this Topic