1Coding an .htaccess 301 Redirect
Find out if your website is running on an Apache server. This is necessary for moving forward with the .htaccess method - check with your web host if you're unsure.
Locate and download your .htaccess file. An .htaccess file is a file that web servers check for information on how to handle errors, security, and redirect requests for your site. Check your root directory (where all your website files are stored) and then download the file for editing.
3Create an .htaccess file. If no .htaccess exists in your root folder currently, you can create one using an application like Notepad (or a similar plain text application). The code for the file is contained in the next step.
- Make sure that when you save your .htaccess file it begins with a “.”
- Note that this file has no tail extension (e.g. “.com” or “.txt”)
4Type in the code. Paste the following code into the .htaccess text file: .
- In the code, "oldURL.com" represents the landing page address your visitors will need to be redirected from while "http://www.newURL.com" represents the address you'd like your visitors redirected to.
- There should be exactly one blank space between "oldURL.com" and "http://"
- Don't add "http://www" to the (old) URL in the first part of the code!
- The code "301" is most commonly used on redirected sites and means "moved permanently". Research other "300" codes to learn about other functions.
Set the new URL destination. Change “http://www.newURL.com” to the domain address you'd like visitors to be redirected to.
Save the new .htaccess file. Change the dropdown to “all files” and save the file as .htaccess with no extension.
Create a backup. Rename any existing .htaccess files or html files with the same name to keep a backup copy. For example use the name .htaccessbackup so that you can find and recognize the file in case you need to do a restore of the previous code.
Upload the modified file to the root directory of the old domain. Now that you've modified the code you need to put this file back so the old URL can read it and redirect as planned.
9Test the redirect. Open a new private browsing window and type the old domain name into your web browser. If you've done everything correctly it will redirect to the new site.
- Using a private browsing window simply ensures that your browser is accessing the new redirect instead of relying on cached data (data stored to help your most commonly visited pages load faster).
- In lieu of a private browsing window, you can also clear your browser's cache through the browser preferences menu. For more information on how to do that, see Clear-Your-Browser's-Cache.
2Using a Redirection Service
Check with your web host. If you're unsure of your own coding ability or just want to redirect a URL without digging into the code, there are several redirection services available and your current web host may be one of them. Many popular web hosts offer redirection services and the accompanying support to help you achieve your goals. Check on the features your current host/plan offers or contact them directly about what your options are.
2Pick a 3rd party service. If your web host doesn't offer redirection, there are many other options out there. Depending on what your redirection needs are you may be able to do this for free.
- Many services allow you to configure options for your redirect such as the type (permanent or temporary) or whether query parameters are passed along.
- Very few redirection services will allow you to forward HTTPS (secure) links.
3Follow the instructions from the redirection service. Typically these services are extremely user-friendly and can help walk you through the process, prompting you at each step for the correct information.
- Note: in some cases you'll still need to be able to edit the DNS (domain name server) records for the domain names you'd like to redirect. These are accessible through your web host.
4Update the DNS records. Your 3rd party redirection provider will let you know if this is necessary and you can access and edit these records from your web hosting account.
- The instructions to edit DNS records this step will vary by the service used, but typically both the redirection service provider and your web host will have easy-to-follow instructions.
3Using a Meta Command
1Access the code for the page you want to redirect. This is a different method that involves you changing the webpage's code directly so you'll first need to download the files associated with the URL(s) you'd like to redirect away from.
- Note that in most cases using a Meta command is not ideal for your redirect. Webpages with Meta code redirects are often filtered by search engines since it's a known spam technique.
Open the code for edits. Use “Notepad” or a similar text editor to open the webpage's code file. Save a backup or duplicate copy before making your edits to the code as a safety measure.
3Amend the code. The Meta code goes after the "head" tag (<head>) in the page's code. Type in :
- There is exactly one blank space between "refresh" and "content"
- "0" here stands for number of seconds before the redirect happens.
- "www.newsite.com/newurl.html" is the specific URL that the page is to be redirected to.
- It's also possible to create a custom error message or an announcement that your sites has moved, but this may draw unwanted attention to your redirect!
Save the file and re-upload to your old domain. If you are redirecting traffic from an old URL, it's likely that other changes have also taken place to your URL's code (e.g. the removal of your site content). What's important is that the URL code now contains the meta redirect code.
Test the redirect. Type the URL into your browser directly or use a search engine to find it. The page should now redirect immediately to the new URL you specified in the code without any messages or landing points in between.
4Using Other Coding Languages
Find out what code your site is written in. For each programming language, the appropriate redirect code may be slightly different. If you're unsure of the answer to this question, contact your web host for more information.
2Research other redirect code. There are different coded commands for each language and several options to explore within each language. A quick internet search is likely to yield the appropriate code for your site.
Test the redirect. After finding the correct code for your site, implementation will be quite similar to the other coding methods outlined. Afterwards always make sure to test the redirect by visiting your (old) URL to see if things work as planned.
Can I redirect a website that I don't own using only my computer?
It depends on what you mean by redirect. If you mean to redirect incoming traffic from the website to wherever you want it to go, then the short answer is no. It's possible, but also illegal depending on where you are, and what the laws are. If you want to direct a link to a destination of your choice, use something like TinyURL or RarME.
Can it be sent straight to a message with no URL?
How can I create an address link for my Instagram ID that doesn't contain the name of Instagram?
You can use a link shortener that will lead to the webpage and you get to choose what the short link will be.
Ask a Question
- While some websites use an error page explaining a change of URL and include a clickable redirect link, this less efficient than an automatic redirect and can end up costing your new site a significant percentage of visitors.
- Users of FrontPage (a once popular website admin tool) will need to modify .htaccess files in _vti_bin and the _vti_bin subfolders _vti_adm and _vti_aut.
- How can I improve writing for PTE
- What is sexism like in Indonesia
- Why does a dog cry before eating
- Are most lawyers litigators
- Which artist originally sang Adorn
- What is instruction decoding unit
- Why do people enjoy solving math puzzles
- Is beef protein good
- Does iPhone give replacement phones
- How does vending machines scan your money
- Does Ticwatch have service centers in India
- How does dance affect your life
- Which one is better IIFL or Zerodha
- What are some examples of quantitative easing
- What are the strongest antibiotics