How to test if mod_rewrite is enabled

apache-2.2mod-rewrite

I'm setting up an environment for wordpress on apache2, on a fresh install of ubuntu 12.04.

In order to get friendly URLS working, I'm trying to set up mod_rewrite. I followed some instructions I found on the net, and used a2enmod.

Now. after restarting apache, I'd like to check if the module is actually loaded.

The command that I've found for getting a list of loaded modules is this:

apache2 -t -D DUMP_MODULES

However, this returns an error:

apache2: bad user name ${APACHE_RUN_USER}

So, how do I actually list all loaded modules, or otherwise check to see if mod_rewrite has been enabled?

Best Answer

KM01 meant apachectl but that will not give you what you need. That will control starting/stopping/restarting of the server, along with giving some status information. The php file option works, but requires some extra work on your part. Instead, try running php from the command line: $ php -i. This outputs what phpinfo() outputs, only on the command line.

You can get a list of compiled-in modules by running $ apache2 -l, but that doesn't help for viewing dynamically loaded modules using the LoadModule (or other) directives.

You can see what modules are being dynamically loaded by looking at the entries in /etc/apache2/mods-enabled/. Some have an additional conf file in the same directory for configuration. Those modules are NOT getting loaded twice. You can see a list of available modules to load dynamically by looking in /etc/apache2/mods-available/. You can enable them on the command line with $ a2enmod <module_name>. You can unload them with $ a2dismod <module_name>.

When you are done enabling/disabling, you must restart apache with $ service apache2 restart or $ apachectl graceful. You will need root (sudo) privileges to do most, if not all, of this work.