How to : Use php htaccess for 301 redirects and domain name forwarding
Hellow guys, Welcome to my website, and you are watching How to : Use php htaccess for 301 redirects and domain name forwarding. and this vIdeo is uploaded by How to : Tips and Trick at 2018-12-08T05:55:05-08:00. We are pramote this video only for entertainment and educational perpose only. So, I hop you like our website.
Info About This Video
Name |
How to : Use php htaccess for 301 redirects and domain name forwarding |
Video Uploader |
Video From How to : Tips and Trick |
Upload Date |
This Video Uploaded At 08-12-2018 13:55:05 |
Video Discription |
Safe and effective web page management
The .htaccess file instructs the web server how to handle certain requests from a web browser or search engine bot. .htaccess can handle multiple requests, including blocking IP addresses and search engine bots altogether. The 301 redirect command is used when the established location of a web page URL is changed and the preservation of search engine indexing and rank is desired. It returns the server response “moved permanently” and is a much safer solution than a “meta refresh.” For domain name forwarding, most website owners have more than one version of a domain name pointing to a single site. An example is a numerical version of a domain name like Section1Wrestling that points to the alpha version of SectionOneWrestling. Some domain registrars have domain name forwarding services, but be aware that some do not provide a search engine friendly redirection. It’s much safer to do it yourself through your .htaccess file and eliminate any potential problems. Step 1 To create your .htaccess file , open up a text editor like Notepad in Windows. You can either save the file as .htaccess now or name and save it after you enter your data into the file. To save the file, click file, save as, then enter .htaccess into the “save as” description box. In the "Save as type" pulldown box, select "All Files" and click the "Save" radio button. There are no other file extensions associated with the file. Step 2 To add the entry into your .htacess file for a 301 redirect “moved permanently:”
redirect 301 /articles/MyFirstArticle.html http://www.MyMainDomainName.com/articles/MyNewArticleLocation.html Step 3 To add the code into your .htaccess file for domain name forwarding, enter the following: Options +FollowSymLinks
RewriteEngine on RewriteCond %{HTTP_HOST} ^www.MySecondDomainName.com [NC] RewriteRule ^(.*)$ http://www.MyMainDomainName.com/$1 [L,R=301] Step 4 If you haven’t already done so, you should also forward your non-WWW domain name version to the full WWW URL. This will prevent the search engines from indexing two versions of your site and hitting the website with duplicate content penalties.
To add the code into your .htaccess file to forward your non-WWW URL to your full WWW URL enter: Options +FollowSymLinks
RewriteEngine on RewriteCond %{HTTP_HOST} ^MyMainDomainName.com [NC] RewriteRule ^(.*)$ http://www.MyMainDomainName.com/$1 [L,R=301] Step 5 Upload the .htaccess file to the server into the root directory of the website . The root directory is the main folder where your Index.html file is located. You’re almost finished, but there’s one more thing to do. And that’s test the functionality of your .htaccess file by typing in the old URLs and web pages to make sure they display the correct pages.
In the event that you already have an .htaccess file on your site, simply pull down a copy and edit it with any changes you need to make, then upload the edited file back up to the server and test the functionality.
Quick Tips: When editing a “live” htaccess file, always save an extra copy of the file in case you screw it up. All it takes is one stray character to make any command useless. |
Category |
Howto & Style |
Tags |
Use php htaccess for | php htaccess for | Use php htaccess | htaccess for | Use php | php htaccess | for |
More Videos