How to write .htaccess

Avatar
  • Answered
I have tried to follow tips and tutorials.. but do not really understand all the code - best make that "any code".
Obviously I am not a pro web site builder and just change text and images in bought templates.
I am trying to meet Googles demands! re Responsive etc,.
I have groups of pages in their own "type of" pages - say 10 pages in each. I have now transferred content to use only seven pages.
How do I write a 301 redirect to send the viewers with links to the three unused pages to the new page ( where the content has been transferred to).
I see some tutorial say the .htaccess goes in the root and another says in the folder of the files concerned - which is correct?



Avatar
Arn
Hello Art2015, Sorry to hear that you're having problems with understanding and creating .htaccess files. We do not really provide code for you (though in some cases we will provide some solutions that come from our tutorials). We will try to help answer your question, however. At this point, we don't really have enough information in order to specifically determine what you need. If you are creating a 301 re-direct, then you're changing an existing link and pointing it to another location. If it's a 301 re-direct, then it's a permanent change, the link you're specifying is the NEW location where your website viewers will be sent. If you change the CONTENT, then you don't have to make the re-direct change, because the OLD content would simply have been updated to use the new content. Is that your intent? If so, then you don't need the re-direct. The Search Engine information would not have to change and you would have updated the information for the existing link. However, let's say that you did not update the old location and you simply created a new one. The problem would be then that the Search Engine would not know about the new location and it would have to be updated with information on the new link - because it is different from the previous one. This would the PRIMARY REASON for the 301 re-direct. A location on your website has changed, and it should now be pointed to this new location. It sounds you're creating links for each page. At some point, all of those links need to exist on a single page. If that is the case, then your .htaccess file would need to go in the folder where the SINGLE page that contains all of the links exists. Sorry, as I know this is a little hard to explain - it would be easier to explain visually: htaccess location You can use the browser to zoom into the screenshot. Apologies for the text, our screenshot option for graphics has been acting awry. Hopefully that will help explain the location the .htaccess files better for you. Based on your comment, it sounds like you have quite a few pages in a single location. However, I'm not sure WHERE the links referencing these pages are located (within your website). The location of the 301 re-direct will need to go in the folder that holds the page for the link. Follow this tutorial. You will be using the FIRST option. Also, you may need to identify if there are multiple links. So, if you have another page that references your pages, you'll need to hunt it down and provide the 301 re-direct as necessary. The difficulty of finishing this task will depend on the complexity and size of your website. It may simply be creating the links in the .htaccess file at the root of your website. Or, it might be finding every folder containing the links and creating an .htaccess for each of those folders. I hope this helps to guide you creating your re-directs. If you follow the tutorial, you'll see that this type of re-direct will not be hard to create. Please let us know if you require any further assistance. Regards, Arnel C.