Use the. htaccess file Setup function to improve the home page optimization effect

Source: Internet
Author: User
Tags php language php file root directory

Website SEO optimization, from the original content for the king, the chain for the emperor, has been transitioning to now from the technical details, from the drip, show the ability to optimize SEO, and often only so, can be in the fierce competition, success, take the default homepage of the site to say it, this is a very small detail, But if not, but often will affect the SEO optimization effect! But generally speaking, the default homepage of the website is very difficult to revise, the construction station program that uses ASP writes often default homepage is. asp, and the Web site written in PHP, the default homepage is. php!

Although now some good space vendors can solve the home page customization function, but the vast majority of space vendors still do not have this function, need to be set to be able to, but why to set it? This is the current search engine for static pages more like, but also more conducive to the search engine's collection, SEO optimization for the promotion site is very useful! So what should I do with a custom default home page not supported by a space provider? This will be done using the. htaccess file Settings feature! Let's take a look at the following picture!

  

This picture is a typical default PHP home page, and a look at this site is written in PHP language! But if the home page defaults to open the first page is the HTML suffix, it does not necessarily mean that the homepage is static, at this time we can check the root directory of the site, There is no index.html or index.shtml file, if not, the open or PHP file, if there is, it will still have to index.html and index.php file Open, contrast, to see if there is no difference, if there is a difference, that the open or index.php file !

In the home page of the index.html or index.php files for analysis, if found or index.php, at this time we can use the. htaccess file Settings! This is where you copy a piece of code first!

<files ~ "^. (HTACCESSHTPASSWD) $ ">
Deny from all
</Files>
DirectoryIndex index.html index.php
Order Deny,allow

The meaning of this code is not difficult to understand, is actually set the Web site to open the root directory file order, first index.html, no longer open the index.php, the same for the use of ASP to write the site, through. htaccess file settings will copy the following code!

<files ~ "^. (HTACCESSHTPASSWD) $ ">
Deny from all
</Files>
DirectoryIndex index.html index.asp
Order Deny,allow

The meaning is very simple, the explanation opens the index.html first, if does not open index.asp!

The above two pieces of code is written according to the development language of the website separately, if some stationmaster does not know own station program is what language writes, only know uses is weaves a dream or Zibo, this time we can copy the following code directly to realize!

<files ~ "^. (HTACCESSHTPASSWD) $ ">
Deny from all
</Files>
DirectoryIndex index.html index.php index.asp index.shtml index.htm index.jsp index.aspx
Deny,allow

This code means that no matter what language environment, as long as the root directory has index.html files, directly open index.html file, otherwise search index.asp,index.php, index.shtml and other documents, if there are above these open!

When the code is written, you can save the code to Notepad, It is then saved as a. htaccess file, and the. htaccess file is uploaded to the root directory of the Web site, and you can implement changes to the default home page, if local does not support. htaccess format modification, which can be uploaded to the Web server space to be modified! This can be seen through. htaccess Setting the default home page is not a very difficult thing! The above content by Www.jyttop.com Jie Yi Tong in admin5 first, reproduced please keep the URL, thank you!



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.