In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
In this issue, the editor will bring you the method of opening url rewriting for apache in Linux, and analyze and describe it from a professional point of view. I hope you can get something after reading this article.
URL rewriting in Apache 2.x is implemented through mod_rewrite.so, so you need to see if Apache has been compiled into this module, and the module has been called in Apache's configuration file httpd.conf.
1. About the call of rewrite module:
URL rewriting in Apache 2.x is implemented through mod_rewrite.so, so you need to check to see if your Apache has been compiled into this module, and the module has been called in Apache's configuration file httpd.conf. In most major distributions, Apache 2.x incorporates the rewrite module. For example, I use Slackware. The configuration file for Apache 2.x is placed in the / etc/httpd directory.
In httpd.conf, we will find a line similar to the following, which is about the rewrite module, whose name is mod_rewrite.so.
LoadModule rewrite_module lib/httpd/modules/mod_rewrite.so
Or
If there is a # in front of LoadModule rewrite_module lib/apache2/modules/mod_rewrite.so, you need to remove it. For most distributions, the modules of Apache 2 are generally located in the following two locations
/ usr/lib/apache2/modules
Or
/ usr/lib/httpd/modules if you open the setting for calling rewrite_module in httpd, check to see if it can be called. You need to check it through the parameter httpd-M.
# / usr/sbin/httpd-M
If you find the following line, the module can already be called.
Rewrite_module (shared)
2. Set the Directory of DocumentRoot:
In Apache 2.x, we will see the line set by DocumentRoot. This line is where web programs are stored. For example, LinuxSir.Org is stored in the / opt/www directory. Then we need to set the DocumentRoot to the following.
DocumentRoot "/ opt/www" and then we have to do targeted behavior settings for DocumentRoot. In general, httpd.conf will give a default. If you want to change the path of DocumentRoot, also change the setting of Directory for DocumentRoot, that is,
For example, if we change the path of DocumentRoot to "/ opt/www", then we also need to change the specific behavior settings of Directory to this path.
Options FollowSymLinks
# AllowOverride None Note: precede this line with a # sign, and then add the following line, which is AllowOverride ALL
AllowOverride ALL
Order allow,deny
Allow from all
We set the parameter of AllowOverride to ALL, which means that URL rule rewriting is supported on the entire server. The Apache server reads the .htaccess file in the root directory of each Web site. If you don't have this file, or if it doesn't define any rules for URL rewriting, it won't have any effect. In general, mature Web server application suites support URL rewriting, such as drupal and joomla. When we use these programs, we will find this file in .htaccess in the installation package. After we have configured Apache, we just need to turn on this feature in the background of these programs.
3. Restart the httpd server:
In general, there are httpd server startup scripts in each distribution, such as
# / etc/rc.d/rc.httpd restart Note: Slackware Linux
# / etc/init.d/apache2 restart Note: ubuntu, Debian, etc.
# / etc/init.d/httpd start Note: Fedora, Redhat, CentOS
The above is the way to enable url rewriting for the apache in Linux shared by the editor. If you have similar doubts, you might as well try it with reference to the above method. If you want to know more about it, please follow the industry information.
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: 269
*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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.