Have you finally been granted that htaccess that you’ve always been waiting for? Have you been told that you’re now responsible for compiling and deploying cross site redirects? It’s a scary thought, especially if you aren’t experience with compiling rewrite rules, but it’s a fantastic milestone as you’ll now be able to do make use of some brilliant tactics.
My main concern when having direct access to the .htaccess file was that I may slip up, or compile an invalid rule and have it put live, sometimes to much responsibility can in fact, be very scary. Implementing an invalid rule could potentially break the htaccess file and therefore, having some of your rules be deemed invalid, this could not only break the site, but affect the end users experience.
Therefore, as I knew there was lots of responsibility in having this access, I needed to know that each and every rule that I wrote was correct. I decided to get to work on excel and create a rule generator, a set of formulas that created the rewrite rule for me, based on URL data I had inputted. This includes having ‘To’ and ‘From’ columns.
This is self explanatory, however, for those that aren’t familiar with the terminology, a short glossary is below;
Redirect definition taken from Techopedia, it’s a brilliant paragraph that summaries what a redirect is, it’s usage, protocols and server-side requirements.
Brief explanation outlining the definition of htaccess from htaccess-guide.com. The htaccess is a large beast, so I wouldn’t be to worried if you’re still not familiar with it’s usage, in time, you’ll learn more about how it can be used and it’s role in website architecture. However, for now;
“htaccess is a configuration file for use on web servers running the Apache Web Server software. When a .htaccess file is placed in a directory which is in turn ‘loaded via the Apache Web Server’, then the .htaccess file is detected and executed by the Apache Web Server software. These .htaccess files can be used to alter the configuration of the Apache Web Server software to enable/disable additional functionality and features that the Apache Web Server software has to offer. These facilities include basic redirect functionality, for instance if a 404 file not found error occurs, or for more advanced functions such as content password protection or image hot link prevention.”
The difficult part isn’t identifying the redirect you require and it’s components, rather the compilation phase and ensuring that your redirect is deployed to live smoothly.
Luckily for you, I am willing to share my redirect master document that does all of the hard work for you in terms of compiling the correct rewriite rule structure. You simply just have to input a To and From URL and it’ll get to work.
How to use the redirect sheet
It’s pretty self-explanatory to understand how to use it, but for those that prefer a step-by-step guide, you can take the following steps to ensure that it’s usage is taken advantage of;
- Download the free redirect spreadsheet on our downloads page;
- Populate the ‘To’ and ‘From’ fields with your chosen relative URL’s;
- If you have any, apply your custom flags in the ‘Extra Flags’ field;
- That’s it! You’ll then have you redirect rule automatically generated for you in the ‘Rule (generated) field.;
- Simply copy and paste this rule into your .htaccess file to utilise the redirect.
- In order for the spreadsheet to work, you must specify a relative URL in the ‘To’ and ‘From’ columns. This means that you shouldn’t use http(s):// or www. when writing your URL’s;
- Be careful in adding extra flags unless you really know what you’re doing, this is an advanced option;
- Depending on the number of entries in the redirect sheet, you may need to expand the formula in row C further;
- All redirects generated as part of this sheet will be a 301, to change this, you will need to update the ‘& “R=301,L]‘ value in the Rule formula, OR you can simply copy and paste the generated rule into a Notepad file and update the 301 text yourself.
By using this spreadsheet, you agree to the following;
- You acknowledge Search3.co.uk’s copyright of this spreadsheet;
- You accept this document “as is”, and understand and acknowledge that no representations or promises of how this spreadsheet will impact your business have been made by Search3 or any of it’s representatives;
- You agree to hold Search3 harmless from any impact of your usage of this spreadsheet.