Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-01-2009, 05:10 PM   #1
Registered: Nov 2006
Posts: 188

Rep: Reputation: 30
Can't enable mod_rewrite

I am probably forgetting something basic, but can someone show me what I am doing wrong when I try to enable the mod_rewrite module for Apache 2.

This is what I am doing:
(Fedora 10 platform)

The mod_rewrite module seems to already be present in the /lib directory

[root@localhost modules]# pwd
[root@localhost modules]# ls -l 
-rwxr-xr-x 1 root root 59256 2008-10-21 06:53
[root@localhost modules]#
I configure apache with the 'enable' extension '--enable-rewrite' and then did a 'make' and 'make-install' without any errors.

When I go into the httpd.conf file, I do not see the "LoadModule' line for mod_rewrite. So, I manually put it in. Here is a snippet of httpd.conf:

LoadModule foo_module modules/
LoadModule php5_module        modules/
LoadModule mod_rewrite         modules/
However, I look over in the apache modules directory, and I don't see it:

[root@localhost modules]# pwd
[root@localhost modules]# ls -l
total 12428
-rw-r--r-- 1 root root     9046 2009-02-01 15:13 httpd.exp
-rwxr-xr-x 1 root root 12691378 2009-01-01 22:57
[root@localhost modules]#
So, I manually copy it over from /usr/lib/httpd/modules:
[root@localhost modules]# pwd
[root@localhost modules]# ls -l
total 12492
-rw-r--r-- 1 root root     9046 2009-02-01 15:13 httpd.exp
-rwxr-xr-x 1 root root 12691378 2009-01-01 22:57
-rwxr-xr-x 1 root root    59256 2009-02-01 15:59
[root@localhost modules]#
I then restart apache, and I get the following error:

[root@localhost conf]# /usr/local/apache2/bin/apachectl restart
httpd: Syntax error on line 54 of /usr/local/apache2/conf/httpd.conf: Can't locate API module structure `mod_rewrite' in file /usr/local/apache2/modules/ /usr/local/apache2/modules/ undefined symbol: mod_rewrite
Can someone show me my error or point me to documentation that might explain how to do this?
Old 02-01-2009, 05:37 PM   #2
Registered: Nov 2006
Posts: 188

Original Poster
Rep: Reputation: 30
I should have added that it looks like the mod_rewrite module is loaded:

[root@localhost modules]# httpd -M
Loaded Modules:
 core_module (static)
 mpm_prefork_module (static)
 http_module (static)
 so_module (static)
 auth_basic_module (shared)
 auth_digest_module (shared)
 authn_file_module (shared)
 authn_alias_module (shared)
 authn_anon_module (shared)
 authn_dbm_module (shared)
 authn_default_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 authz_owner_module (shared)
 authz_groupfile_module (shared)
 authz_dbm_module (shared)
 authz_default_module (shared)
 ldap_module (shared)
 authnz_ldap_module (shared)
 include_module (shared)
 log_config_module (shared)
 logio_module (shared)
 env_module (shared)
 ext_filter_module (shared)
 mime_magic_module (shared)
 expires_module (shared)
 deflate_module (shared)
 headers_module (shared)
 usertrack_module (shared)
 setenvif_module (shared)
 mime_module (shared)
 dav_module (shared)
 status_module (shared)
 autoindex_module (shared)
 info_module (shared)
 dav_fs_module (shared)
 vhost_alias_module (shared)
 negotiation_module (shared)
 dir_module (shared)
 actions_module (shared)
 speling_module (shared)
 userdir_module (shared)
 alias_module (shared)
 rewrite_module (shared)
 proxy_module (shared)
 proxy_balancer_module (shared)
 proxy_ftp_module (shared)
 proxy_http_module (shared)
 proxy_connect_module (shared)
 cache_module (shared)
 suexec_module (shared)
 disk_cache_module (shared)
 file_cache_module (shared)
 mem_cache_module (shared)
 cgi_module (shared)
 proxy_ajp_module (shared)
Syntax OK
However, even with the 'Load Module' line in httpd.conf, upon restarting apache, I still receive the error:

[root@localhost conf]# /usr/local/apache2/bin/apachectl restart
httpd: Syntax error on line 54 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/mod_rewrite into server: /usr/local/apache2/modules/mod_rewrite: cannot open shared object file: No such file or directory
Old 02-01-2009, 05:53 PM   #3
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,154
Blog Entries: 1

Rep: Reputation: 2019Reputation: 2019Reputation: 2019Reputation: 2019Reputation: 2019Reputation: 2019Reputation: 2019Reputation: 2019Reputation: 2019Reputation: 2019Reputation: 2019
[root@localhost modules]# httpd -M
Loaded Modules:
<b>rewrite_module (shared)</b>
Syntax OK
I think that you have another apache installed probably with your distro, unless /usr/local/apache2/bin/httpd is in your PATH. The way you configured apache, mod_rewrite is built-in apache, so in the above example is should shown as static, not shared.
And for this reason you don't need the "LoadModule mod_rewrite ..."
The module you've copied is from the other apache installation, that's why you get the "undefined symbol" error.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
mod_rewrite delmoras Linux - Newbie 1 01-12-2009 12:16 PM
mod_rewrite basarab1310 Linux - Newbie 1 11-06-2008 08:57 AM
How to enable Apache mod_rewrite, after apache installed without this modue jCash Linux - Newbie 1 10-24-2006 11:23 AM
mod_rewrite mr_dizzle Linux - General 1 02-02-2006 08:32 PM
enable mod_rewrite in apache 1.3.9 robertngo Linux - Software 4 07-18-2005 04:02 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:21 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration