![]() |
.htaccess 301 Redirect
If you have a standard Linux server, you probably have Apache as the actual Web server software. The other alternatives include Lighttpd (pronounced “Lighty”) and Nginx (pronounced “Engine-X”) but they’re not overly common. If you have a file called “.htaccess” in your “public_html” folder, you know you’ve got Apache running on your server.
.htaccess file 301 Redirects taught on this page include: Redirect a Single Page Redirect an Entire Site Redirect all subpages without redirecting the entire domain Redirect a site to WWW Redirect a site to Non-WWW Note: If you end your old site or folder URL with a / it will keep the names and folders that are accessed intact so if you create a redirect from www.website.com/data/ to www.kickasswebsite.com/data/ and a visitor attempts to go to www.website.com/data/oldpage.htm will become www.kickasswebsite.com/data/oldpage.htm. This ability will help you most when you need to transfer a site to a new domain. Also, I am using FileZilla as my FTP program and these instructions are tailored to it. If you use a different FTP program, the processes may vary. How To Redirect a single page Log in to your web hosting account in your FTP program and navigate to the /public_html folder. Right-Click on the file called “.htaccess”. Choose “View/Edit”. Right at the top, copy in one of the lines below that starts with “Redirect 301″. Change the “/oldpage.html” to the page or folder you want to redirect from. Change the http://www.yoursite.com/newpage.html” to the page or folder you want visitors to go to. Save the document. Close the file editor. Click in the FTP Editor. Click on “Finish editing and delete local file.” Code:
The Code Required:Log in to your web hosting account in your FTP program and navigate to the /public_html folder. Right-Clisk on the file called “.htaccess”. Choose “View/Edit”. Right at the top, copy in one of the lines below that starts with “Redirect 301″. Change the http://website.com/” to the page or folder you want visitors to go to. Save the document. Close the file editor. Click in the FTP Editor. Click on “Finish editing and delete local file.” Code:
The Code Required:If you need to 301 redirect all the subpages of a domain but don’t want to redirect www.domain.com itself, you can use the following bit of code. Code:
RewriteEngine onSome people want to have the WWW at the beginning of your URL. Other people think it looks grittier not to have it. Whichever you prefer, and thankfully it doesn’t truly matter, is up to you. Doing a redirect from websitecom to wwwwebsitecom is fine as long as it is a correct 301 redirect. It’s also perfectly acceptable to redirect wwwwebsitecom to websitecom. It’s just best if you do choose 1 way or the other for SEO because Google can view website.com and www.website.com as separate sites. This means that if you have incoming links going to both website.com and www.website.com there’s a chance that they will both build up different pages in Google’s eyes. So to correct that, here’s how you can make everything look uniform using the htaccesss file. Redirect to WWW with the htaccesss file To edit the .htaccess file, follow the instructions above and insert the following code at the head of the file. Code:
RewriteEngine OnCode:
RewriteEngine OnIf you have multiple pages that come up with a 404 error and you don’t want to take the time to redirect each and every one, I highly recommend entering the following code into your .htaccess file. It’ll automatically redirect all 404 error pages to your home page, thus saving your SEO and keeping people on your site. Code:
RewriteEngine on |
Code:
http://www.free-patent-search.net/product |
| All times are GMT +8. The time now is 10:54 AM. |
Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.