Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem that .htaccess doesn't work under CentOS

2025-03-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

In this article, the editor introduces in detail "how to solve the problem that .htaccess does not work under CentOS". The content is detailed, the steps are clear, and the details are handled properly. I hope this article "how to solve the problem if .htaccess does not work under CentOS" can help you solve your doubts.

As a result, click on a link directly 404 not found. Tragically, there seems to be something wrong with the rewrite part of apache, completely ignoring the .htaccess file! After checking the module of apache, it is found that the rewrite module is open. It seems that there is something wrong with the configuration in the httpd.conf file. Recall that configuring rewrite under ubuntu server also enabled a property called "allowoverride" to "all" to enable rewrite correctly. This time the manual configuration of virtualhost did not write these two sentences, so it seems that this is the problem.

Enter immediately:

# vim / etc/httpd/conf/httpd.conf

Find your own virtualhost settings section and add

Allowoverride all

The "/" of directory / above is your www path. If you put it under the "/ var/www/html" path, write "", and so on. Restart the httpd service after saving:

# / etc/init.d/httpd restart

Enter wordpress again, click on a link, and it's done! Problem solved. It seems that this "allowoverride" is not simple! So I looked around the Internet and found that this is the key point to control .htaccess. In addition to opening rewrite in apache and setting the .htaccess file name correctly, you also need to configure the allowoverride of the directory because the allowoverride value is none by default, which ignores the .htaccess file completely.

In addition, in addition to the values all and none, allowoverride has many values, which have the following meanings:

Authconfig

Allow the use of instructions related to authentication authorization (authdbmgroupfile, authdbmuserfile, authgroupfile, authname, authtype, authuserfile, require, etc.).

Fileinfo

Instructions that control document types (defaulttype, errordocument, forcetype, languagepriority, sethandler, setinputfilter, setoutputfilter, add* and remove* instructions in mod_mime, etc.), instructions to control document metadata (header, requestheader, setenvif, setenvifnocase, browsermatch, cookieexpires, cookiedomain, cookiestyle, cookietracking, cookiename), instructions in mod_rewrite (rewriteengine, rewriteoptions, rewritebase, rewritecond, rewriterule) and action directives in mod_actions are allowed.

Indexes

Instructions that control directory indexes (adddescription, addicon, addiconbyencoding, addiconbytype, defaulticon, directoryindex, fancyindexing, headername, indexignore, indexoptions, readmename, etc.) are allowed.

Limit

Allow the use of instructions (allow, deny, order) that control host access.

Options [= option,...]

Allows the use of instructions (options and xbithack) that control the function of the specified directory. You can append a comma-separated (space-free) list of options options after the equal sign to control which options are allowed for the options instruction.

After reading this, the article "how to solve the problem if htaccess doesn't work under CentOS" has been introduced. If you want to master the knowledge of this article, you still need to practice and use it to understand it. If you want to know more about related articles, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report