• bugzbrian2

    (@bugzbrian2)


    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 https:// reynoldspest.com/ reynoldsblog/sitemap.xml to https:// https://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

Viewing 11 replies - 1 through 11 (of 11 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

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

    For everything or JUST the sitemap?

    Thread Starter bugzbrian2

    (@bugzbrian2)

    I am only having trouble with some (not all) non “WWW” in my blog converting to “WWW” i.e. https://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

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Yeah I get that. What I’m asking is if you want ALL of your https://reynoldspest.com/ URLs to look like https://www.reynoldspest.com/ or https://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?

    Thread Starter bugzbrian2

    (@bugzbrian2)

    Yes, they all should be WWW

    Thank you

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    That’s easiest of all! ??

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

    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^www.reynoldspest.com$
    RewriteRule ^(.*)$ https://www.reynoldspest.com/$1 [R=301]
    Thread Starter bugzbrian2

    (@bugzbrian2)

    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. ??

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

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

    Thread Starter bugzbrian2

    (@bugzbrian2)

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

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Yes-I changed them about a week ago and they all redirect except the https://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.

    Thread Starter bugzbrian2

    (@bugzbrian2)

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

    Thread Starter bugzbrian2

    (@bugzbrian2)

    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

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Trying to do a 301 redirect in .htaccess for my wordpress blog in a sub-directoy’ is closed to new replies.