Linux allows Apache to support mod_rewrite modules __linux
Source: Internet
Author: User
If your server Apache has not been installed, it is very simple, in the compilation of Apache when the Mod_rewrite module into the can if your Apache has been installed, now only want to compile the Mod_ Rewrite.so module, which is loaded in Apache, we'll introduce this method below. 1 Install Apache for the first time, add –enable-rewrite option at compile time. such as./configure–prefix=/opt/apache–enable-so–enable-mods-shared=all–enable-rewrite–enable-cache 2) Add mod_rewrite module # Find. -name mod_rewrite.c//Find mod_rewrite.c file in Apache source installation directory (2.2.8 under directory httpd-2.2.8/modules/mappers) # CD Path/to/mod_ REWRITE.C//Enter the directory containing mod_rewrite.c file #/opt/apache/bin/apxs-c mod_rewrite.c//apxs should specify an absolute path in the bin directory where you are currently using Apache/opt/ Apache/bin/apxs-i-a-n mod_rewrite mod_rewrite.la If there is nothing wrong, you should compile a modules file in your Apache mod_rewrite.so directory. Edit the httpd.conf file to confirm that the httpd.conf already contains the mod_rewrite.so load statement, as follows: LoadModule Rewrite_module modules/mod_rewrite.so
################################################### If this error occurs
Syntax error on line 329 of/usr/local/apache2/conf/httpd.conf:
Can ' t loacte API module staructure ' mod_rewrite_module ' in file
/usr/local/apache2/modules/mod_rewrite.so:/usr/local/apache2/lib/libapr-
0.so.0:undefined Symbol:mod_rewrite_module
Modify Http.conf
Originally: The httpd.conf inside writes Mod_rewrite_module
Change into Rewrite_module
If you restart Apache this error module Rewrite_module is built-in and can ' t be loaded
Indicates that the module is built inside, no need to be transferred, comment out
#LoadModule Rewrite_module modules/mod_rewrite.so
##################################################### check: [root@www httpd-2.2.8]#. /bin/apachectl Configtest
Syntax OK at this time, your Apache should already support rewrite.
Vicos Note: After completing, remember to reboot the server Apache.
Note that the next step is to configure the virtual host to be similar to the following settings to take effect: <virtualhost *:80>
documentroot/var/www/www/www.fastu.cn/
ServerName [Url]www.fastu.cn[/url]
<Directory/var/www/www/www.fastu.cn/>
Options FollowSymLinks
AllowOverride All
Order Allow,deny
Allow from all
</Directory>
</VirtualHost>
If AllowOverride is set to none, Apache does not read the. htaccess file for the Web site.
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.