• madridben2

    (@madridben2)


    Hi,

    I have some files in sub-folder on my site, that I want to redirect via a 301 redirect in an htaccess file.
    So the files are in mydomain.com/store/
    e.g. mydomain.com/store/beginners.html

    I know how to do the 301 redirect in an htaccess file, what I’m not sure about is where to put the 301 redirects – in an htaccess file in my webroot? Or in the /store/ folder?

    Thanks for any help.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Pioneer Web Design

    (@swansonphotos)

    Put them just above the WP Permalink rules. Test (each rule).

    Note: Once the redirects are all in place and tested, you need not actually host those old files as no one will ever get to them.

    Thread Starter madridben2

    (@madridben2)

    Thanks for taking time to answer. I had actually put them just below the WP Permalink rules and they work OK, is that alright? Or do they have to be above? They are not WordPress pages, they are html pages in a separate subfolder.

    Also, one last question, is it OK to have several old files pointing to a single new page?

    Thanks again.

    • This reply was modified 6 years ago by madridben2.
    Pioneer Web Design

    (@swansonphotos)

    Or do they have to be above?

    The 301’s should occur before the permalinks rules.

    …is it OK to have several old files pointing to a single new page?

    Yes. But you should ask the search engines to re-index the site (for SEO) if those links have been up for any period of time.

    Thread Starter madridben2

    (@madridben2)

    Thanks enormously for your help. One last question – I have many lines of WP Rocket caching plugin code in my htaccess file above the permalink rules. Should my 301 redirects go above these as well, at the very top?
    Thanks again.

    Pioneer Web Design

    (@swansonphotos)

    I would ask that WP Rocket Developer. They may use the .htaccess rules in a manner not expected otherwise.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Where to put 301 redirect htaccess file’ is closed to new replies.