Solution to disable. htaccess in CentOS

Source: Internet
Author: User

The result is 404 Not Found directly by clicking a link. Tragedy, it seems that there is a problem with Apache Rewrite, And the. htaccess file is completely ignored! After checking the Apache module, we found that the Rewrite module is enabled. It seems that the configuration in the httpd. conf file is a bit faulty. Recall that previously, configuring Rewrite in Ubuntu Server also enables the attribute "All" called "AllowOverride" to correctly enable Rewrite, this is the problem.

Enter:

# Vim/etc/httpd/conf/httpd. conf
Find your VirtualHost settings.

<Directory/>
AllowOverride All
</Directory>
The Directory/"/" in the preceding section is your www path, for example, in the "/var/www/html" path, write it as "<Directory/var/www/html>", and so on. Restart the httpd service after saving:

#/Etc/init. d/httpd restart
Go to WordPress again and click a link! Solve the problem. It seems that this "AllowOverride" is not simple! So I searched the internet and found that this is the key point to Control. htaccess. In addition to the need to enable Rewrite in Apache and correct settings. in addition to the htaccess file name, you also need to configure AllowOverride of the Directory, because the value of AllowOverride is None by default, which will be completely ignored. htaccess file.

In addition to the values 'all' and 'none', AllowOverride also has many values whose meanings are as follows:

AuthConfig
Commands related to authentication and authorization are allowed (AuthDBMGroupFile, AuthDBMUserFile, AuthGroupFile, AuthName, AuthType, AuthUserFile, Require, and so on ).

FileInfo
Commands that control document types are allowed (DefaultType, ErrorDocument, ForceType, LanguagePriority, SetHandler, SetInputFilter, SetOutputFilter, Add * and Remove * commands in mod_mime) command (Header, RequestHeader, SetEnvIf, delimiter, BrowserMatch, CookieExpires, CookieDomain, CookieStyle, delimiter, CookieName), commands in mod_rewrite (RewriteEngine, RewriteOptions, RewriteBase, callback, rewriteRule) and Action commands in mod_actions.

Indexes
Allows the use of commands that control directory indexes (AddDescription, AddIcon, AddIconByEncoding, AddIconByType, DefaultIcon, DirectoryIndex, FancyIndexing, HeaderName, IndexIgnore, IndexOptions, ReadmeName, etc ).

Limit
Allows the use of commands (Allow, Deny, Order) that control access to the host ).

Options [= Option,...]
Allows you to use commands (Options and XBitHack) that control the functions of a specified directory ). You can add a comma-separated (no space) Options list after the equal sign to control the Options that can be used by the Options command.

In this case, with All and None, there are seven optional values. It seems that we have gained a lot of insights! Similar problems will occur in the future. In any Linux system, I can easily find the problem!

Related Article

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.