Viewing 15 replies - 1 through 15 (of 51 total)
  • Plugin Author AITpro

    (@aitpro)

    This is an online htaccess redirect code generator >>> https://www.htaccessredirect.net/

    It is going to depend on what you are trying to redirect and to where.
    Please post specific examples of what you are trying to do. Also are the redirects inside the WordPress rewrite loop or outside the WordPress rewrite loop?
    Example:

    //301 Redirect Old File
    Redirect 301 somefile.php somefile-new-location.php

    //301 Redirect Entire Directory
    RedirectMatch 301 /some-folder/(.*) /some-new-folder-location/$1

    Plugin Author AITpro

    (@aitpro)

    Did this info answer your question? If so, please resolve this question. Thanks.

    Plugin Author AITpro

    (@aitpro)

    Ok well i guess you are crazy busy so i am resolving this thread. please reopen it if you need any other info. Thanks.

    Thread Starter gotmedia

    (@gotmedia)

    Hi!

    Well, the redirects are sort of outside the loop. This is a redirect I’d like to happen:

    https://www.wepcoinc.com/smartroller.html
    should redirect to
    https://www.wepcoinc.com/smartroller/ (now WordPress)

    I see the link you gave me. What would you like me to do with the code that it generates? Where would that go?

    Thank you!

    Plugin Author AITpro

    (@aitpro)

    Ok then you would do something like this then if you are in the scenario of generally trying to redirect ALL old html pages from a site that was previously an HTML site to a new site that is now WordPress.

    https://stackoverflow.com/questions/11926237/redirecting-old-html-page-to-new-without-html-extension-page

    You would add your redirect code to BPS Custom Code, save this code, then click the AutoMagic buttons and activate BulletProof Mode for your Root folder again.
    Root htaccess File Custom Code

    CUSTOM CODE TOP: Add php.ini handler code and / or miscellaneous custom code here


    …Add your new redirect custom code here…

    Thread Starter gotmedia

    (@gotmedia)

    Hi there,

    Thanks! However, some pages are going to be different.

    There will probably be a few like this:

    https://www.wepcoinc.com/home_r1.html
    redirects to
    https://www.wepcocinc.com/conveyors/

    So do I follow the same instructions (as in adding the code to the BPS custom code, etc.)?

    Thank you!

    Plugin Author AITpro

    (@aitpro)

    how many pages total do you have to redirect? it might be better to just do the redirects individually if you only have a small number of them – 100 pages or less to redirect.

    Plugin Author AITpro

    (@aitpro)

    so if you want the simplest and most basic redirect method for a small number of redirects then here it is:

    This redirects a file named example-page.html that is in the website root folder to a blog post named conveyors. Your redirect for home_r1.html to blog post conveyors is also shown.

    RedirectMatch 301 /example-page.html /conveyors/index.php
    
    or without displaying index.php
    
    RedirectMatch 301 /example-page.html /conveyors/
    
    RedirectMatch 301 /home_r1.html /conveyors/index.php
    
    or without displaying index.php
    
    RedirectMatch 301 /home_r1.html /conveyors/
    Plugin Author AITpro

    (@aitpro)

    I assume this answered all of your questions. Resolving this thread. Thanks.

    Thank you for the information!

    I have followed your instructions with regard to using the custom code and for the first time (from the various methods I have tried), the redirect is working. However, the redirect is going to the main page, rather than the desired page.

    This is all on the same domain… I am cleaning up old .php and .html pages that have been replaced with WordPress pages.

    Is there another setting that is forcing redirects to the main page?

    This is the redirect I tested with:
    Redirect 301 /immunocal.science.php https://www.immunocal.md/science/

    When I go to the old URL, I arrive at immunocal.md

    What is my next step?

    Thanks!

    Plugin Author AITpro

    (@aitpro)

    Use RedirectMatch instead of redirect and in your case it is important to escape the dot otherwise the dot will match more than just a single/literal dot and match anything. I am not sure why you were adding the domain name. You are just trying to match and redirect the file named science.php correct?

    RedirectMatch 301 ^/science\.php$ https://www.immunocal.md/science/

    Plugin Author AITpro

    (@aitpro)

    comment/code was updated…

    No, the original page is https://immunocal.md/immunocal.science.php

    In fact, the very first page was with .html extension, so I have to redirect that one also. I have a whole list of pages to redirect.

    Plugin Author AITpro

    (@aitpro)

    Well that might be a problem since your file name is the same as your domain name and could cause a redirect loop, but it may not – very strange file name??? Try it…

    RedirectMatch 301 ^/immunocal\.science\.php$ https://www.immunocal.md/science/

    Yes, I was (and still am) learning about SEO…

    I will try doing one of the files that does not contain immunocal in the name and will also try your suggestion… back shortly.

Viewing 15 replies - 1 through 15 (of 51 total)
  • The topic ‘Where to add 301 Redirects?’ is closed to new replies.