Add a backslash after the site directory specific steps and Precautions _ website operation

Source: Internet
Author: User
Step One: Confirm the website open rewrite rules
In general, there are two kinds of situations:
I.apache installation already contains rewrite features
Ii. new additions to the mod_rewrite.so when the configuration is followed. This situation requires modifying the configuration boot in the httpd.conf file
Found in httpd.conf in the Conf directory
LoadModule Rewrite_module modules/mod_rewrite.so
This sentence, remove the front annotation symbol "#", or add this sentence.
Allow the ". htaccess" file to be used in any directory and change "allowoverride" to "all" (Default "None"):
# AllowOverride Controls What directives may is placed in. htaccess files.
# It can be ' all ', ' None ', or any combination of the keywords:
# Options FileInfo authconfig Limit
#
AllowOverride All

Step Two: Add the. htaccess file
Create a new 1.txt file locally, and write the following:
Rewriteengine on
Rewritebase/
Rewritecond%{request_filename}!-f
Rewritecond%{request_uri}! (.*)/$
Rewriterule ^ (. *) $ http://www.sample.cn/$1/[l,r=301]
This code means to add a "/" directory to the back of the site without "/".
Description
* Rewritecond%{request_filename}!-f: Specifies that the operation is for the directory only and does not rewrite to the URL that points to the file;
* Rewritecond%{request_uri}! (. *)/$: Determines whether the URL ends with a slash "/";
* Rewriterule ^ (. *) $ http://kayosite.com/$1/[l,r=301]: Automatically redirects URLs that meet the above criteria to a version that ends with a backslash, such as "HTTP://SAMPLE.COM/FXG" Redirect to "http://kayosite.com/fxg/", where "L" means the last line of the code of Conduct, and "r=301" indicates the use of the Redirect. Of course, you should replace "http://kayosite.com/" with the URL of your own web site when you use it.

Upload 1.txt files to the site root directory. After uploading, it is renamed. htaccess.
"Note". htaccess file is a special file under Linux, no name before the dot, upload, the default hidden, but you can edit VI htaccess

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.