# apache 2.2 global mod_rewrite not working

## eGore911

The default configuration of apache on gentoo seems to disable mod_rewrite

somehow. I have the following setup:

Installed apache

Created /etc/apache2/modules.d/99_mod_rewrite.conf

Added to 99_mod_rewrite:

```
<IfModule mod_rewrite.c>

RewriteEngine On

RewriteRule ^/useless/.* /${1} [PT,L]

RewriteLog "/var/log/apache2/rewrite_log"

RewriteLogLevel 3

</IfModule>
```

verified "LoadModule rewrite_module modules/mod_rewrite.so" is in httpd.conf

started apache

opened http://localhost/useless/index.html

got sad

I've been trying to figure out what hinders mod_rewrite from working. The

module is loaded and an empty /var/log/apache2/rewrite_log is created. So the

config is working. But it doesn't trigger. And nothing is written to the log

file.

I guess that the issue is somewhere in the way apache is configured by default

on gentoo, but I can't find what is wrong. Or if I'm just being plain stupid

----------

## MotivatedTea

I'm far from an apache expert. However, when I wanted to use some software that made use of mod_rewrite, I had to do the following to get it to work:

In your the config file for your site inside "/etc/apache2/vhosts.d" (probable default_vhost.include unless you've changed it), you need to find or create a <Directory> entry for the path for which you are trying to enable mod_rewriting, and you need to add a directive "AllowOverride All". Otherwise, even though you have mod_rewrite loaded, it is prevented from acting. For example, a portion of my default_vhost.include looks like this:

```

<Directory "/var/www/localhost/htdocs">

        Options Indexes FollowSymLinks ExecCGI

        AllowOverride All

        Order allow,deny

        Allow from all

</Directory>

```

Security disclaimer: This configuration might be less secure than some people would like. "All" is not the only option to "AllowOverride". There are more specific options, but I don't know which of those are required for mod_rewrite. Also, the other lines in the code snippet above do stuff that's unrelated to your current issue. (Turning on CGI script execution, allowing symlinks, and allowing "all" access will probably make professional web admins cringe. However, this server is only running on a local home network for family use and is not exposed to the "outside" internet; so, security is not a concern here for me.)

So, the bottom line is that you probably need to put in an "AllowOverride" directive for the path containing the code for which you want to enable rewriting. Try "AllowOverride All" first to see if it fixes your problem. If it works, then look at the apache documentation for the "AllowOverride" directive and for mod_rewrite, and see if you can make do with a less permissive setting. If it doesn't work, then I'll step back and let someone more experienced help.

----------

## eGore911

I read about the "AllowOverride" earlier and played around with it. Sadly the config you posted is exaclty my default_vhost.include (plus a few comments). My idea is that this "AllowOverride" is overwritten somewhere later, but I could not find any place where this would happen (especially since vhosts are the last thing included in /etc/apache/httpd.conf).

Next to that I think that AllowOverride will not work for global mod_rewrite configuration, but only for .htaccess-config.

----------

## Mad Merlin

 *eGore911 wrote:*   

> 
> 
> ```
> <IfModule mod_rewrite.c>
> 
> ...

 

Did you build Apache with mod_rewrite support?

----------

## frenkel

Are there any errors in your error log?

----------

## eGore911

Mad Merlin:

yes, the module is built and can be loaded. It will even throw errors at me if I force errors in the config file

frenkel:

no, sadly not. It just does not do anything.

Am I the only one having this issue? Or is noone using apache2 with global mod_rewrite rules?

----------

## frenkel

If you don't see any errors, I'm almost sure the module is not active. Is there a place in your config where you actually load the module?

----------

## eGore911

```
grep rewrite /etc/apache2/httpd.conf 

LoadModule rewrite_module modules/mod_rewrite.so
```

And it's not in some IfDefine. I also started apache with debugging enabled (don't remember the option right now) and it stated that the module gets loaded. Another sign that the module is loaded is that it create the log file to be used for rewrites.

Also:

```
apache2 -M | grep rewrite

rewrite_module (shared)
```

----------

## frenkel

What happens if you remove the IfModule? Those lines are for servers that don't have mod_rewrite. Do you see any errors in your logs than? (Not in the access log, but in the error log)

----------

## eGore911

Removed the IfModule, changed nothing ... as I said  :Smile:  The complete error_log is below

```

[Fri Jul 03 11:02:28 2009] [info] Init: Seeding PRNG with 144 bytes of entropy

[Fri Jul 03 11:02:28 2009] [info] Init: Generating temporary RSA private keys (512/1024 bits)

[Fri Jul 03 11:02:28 2009] [info] Init: Generating temporary DH parameters (512/1024 bits)

[Fri Jul 03 11:02:28 2009] [info] Init: Initializing (virtual) servers for SSL

[Fri Jul 03 11:02:28 2009] [info] mod_ssl/2.2.11 compiled against Server: Apache/2.2.11, Library: OpenSSL/0.9.8k

[Fri Jul 03 11:02:28 2009] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)

[Fri Jul 03 11:02:28 2009] [info] mod_unique_id: using ip addr 127.0.0.1

[Fri Jul 03 11:02:29 2009] [info] Init: Seeding PRNG with 144 bytes of entropy

[Fri Jul 03 11:02:29 2009] [info] Init: Generating temporary RSA private keys (512/1024 bits)

[Fri Jul 03 11:02:29 2009] [info] Init: Generating temporary DH parameters (512/1024 bits)

[Fri Jul 03 11:02:29 2009] [debug] ssl_scache_shmcb.c(253): shmcb_init allocated 512000 bytes of shared memory

[Fri Jul 03 11:02:29 2009] [debug] ssl_scache_shmcb.c(272): for 511920 bytes (512000 including header), recommending 32 subcaches, 133 indexes each

[Fri Jul 03 11:02:29 2009] [debug] ssl_scache_shmcb.c(306): shmcb_init_memory choices follow

[Fri Jul 03 11:02:29 2009] [debug] ssl_scache_shmcb.c(308): subcache_num = 32

[Fri Jul 03 11:02:29 2009] [debug] ssl_scache_shmcb.c(310): subcache_size = 15992

[Fri Jul 03 11:02:29 2009] [debug] ssl_scache_shmcb.c(312): subcache_data_offset = 3208

[Fri Jul 03 11:02:29 2009] [debug] ssl_scache_shmcb.c(314): subcache_data_size = 12784

[Fri Jul 03 11:02:29 2009] [debug] ssl_scache_shmcb.c(316): index_num = 133

[Fri Jul 03 11:02:29 2009] [info] Shared memory session cache initialised

[Fri Jul 03 11:02:29 2009] [info] Init: Initializing (virtual) servers for SSL

[Fri Jul 03 11:02:29 2009] [info] mod_ssl/2.2.11 compiled against Server: Apache/2.2.11, Library: OpenSSL/0.9.8k

[Fri Jul 03 11:02:29 2009] [info] mod_unique_id: using ip addr 127.0.0.1

[Fri Jul 03 11:02:30 2009] [debug] proxy_util.c(1801): bla bla bla

[Fri Jul 03 11:02:30 2009] [notice] Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8k configured -- resuming normal operations

[Fri Jul 03 11:02:30 2009] [info] Server built: Jun 19 2009 11:50:55

[Fri Jul 03 11:02:30 2009] [debug] worker.c(1740): AcceptMutex: sysvsem (default: sysvsem)

[Fri Jul 03 11:04:52 2009] [error] [client 127.0.0.1] File does not exist: /var/www/localhost/htdocs/useless

```

----------

## frenkel

After seeing your log, I found out the error.

Your rewrite rule is wrong. For starters, it never includes the starting /, so you should change ^/useless to ^useless. Furthermore, the parameter is not filled, because it doesn't know what to fill it with. You fill the $1 with a match if it's included in ( and ) signs. So, (.*) would fill $1 with everything.

To sum things up, this should be the rewrite rule:

```

RewriteRule ^useless/(.*) $1 [PT,L] 

```

I find it weird that your rewrite log was empty (or wasn't it?).

----------

## eGore911

I changed the rewrite rule to exactly what you suggested ... and ... it still does not work. So that was not the error. I still don't get a log. And nothing happens.   :Sad: 

----------

## eGore911

Ok, I tried to get a bit closer to the solution. I installed the binary apache and hacked the configuration of it, and used it with the native linux one. This config works ok.

```

ServerRoot "/usr/lib64/apache2"

Listen 80

LoadModule actions_module modules/mod_actions.so

LoadModule alias_module modules/mod_alias.so

LoadModule auth_basic_module modules/mod_auth_basic.so

LoadModule authn_default_module modules/mod_authn_default.so

LoadModule authn_file_module modules/mod_authn_file.so

LoadModule authz_default_module modules/mod_authz_default.so

LoadModule authz_groupfile_module modules/mod_authz_groupfile.so

LoadModule authz_host_module modules/mod_authz_host.so

LoadModule authz_user_module modules/mod_authz_user.so

LoadModule autoindex_module modules/mod_autoindex.so

LoadModule dir_module modules/mod_dir.so

LoadModule env_module modules/mod_env.so

LoadModule include_module modules/mod_include.so

LoadModule log_config_module modules/mod_log_config.so

LoadModule mime_module modules/mod_mime.so

LoadModule negotiation_module modules/mod_negotiation.so

LoadModule rewrite_module modules/mod_rewrite.so

LoadModule setenvif_module modules/mod_setenvif.so

<IfModule !mpm_netware_module>

<IfModule !mpm_winnt_module>

User daemon

Group daemon

</IfModule>

</IfModule>

ServerAdmin i@dont.care

DocumentRoot "/var/www/localhost/htdocs"

<Directory />

    Options FollowSymLinks

    AllowOverride None

    Order deny,allow

    Deny from all

</Directory>

<Directory "C:/Programme/Apache Software Foundation/Apache2.2/htdocs">

    Options Indexes FollowSymLinks

    AllowOverride None

    Order allow,deny

    Allow from all

</Directory>

<IfModule dir_module>

    DirectoryIndex index.html

</IfModule>

<FilesMatch "^\.ht">

    Order allow,deny

    Deny from all

    Satisfy All

</FilesMatch>

ErrorLog "logs/error.log"

LogLevel warn

<IfModule log_config_module>

    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>

      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

    </IfModule>

    CustomLog "logs/access.log" common

</IfModule>

<IfModule alias_module>

    ScriptAlias /cgi-bin/ "C:/Programme/Apache Software Foundation/Apache2.2/cgi-bin/"

</IfModule>

<IfModule cgid_module>

</IfModule>

<Directory "C:/Programme/Apache Software Foundation/Apache2.2/cgi-bin">

    AllowOverride None

    Options None

    Order allow,deny

    Allow from all

</Directory>

DefaultType text/plain

<IfModule mime_module>

    TypesConfig conf/mime.types

    AddType application/x-compress .Z

    AddType application/x-gzip .gz .tgz

</IfModule>

<IfModule ssl_module>

SSLRandomSeed startup builtin

SSLRandomSeed connect builtin

</IfModule>

RewriteEngine On

RewriteRule ^useless/(.*) /${1} [PT,L]

RewriteLog "/var/log/apache2/rewrite_log"

RewriteLogLevel 3

```

I changed nothing from it except a few white space lines. Next to the fact that this config is 99% broken, it works. Man, there got to be some thinko somewhere in gentoos default config. Something that resets my changes?

----------

## frenkel

The rules I posted work fine for me.

Can you post your error_log again with my rewrite rule?

----------

## eGore911

I think the log did not actually change. But here it is.

```

[Mon Jul 06 10:28:20 2009] [info] Init: Seeding PRNG with 144 bytes of entropy

[Mon Jul 06 10:28:20 2009] [info] Init: Generating temporary RSA private keys (512/1024 bits)

[Mon Jul 06 10:28:21 2009] [info] Init: Generating temporary DH parameters (512/1024 bits)

[Mon Jul 06 10:28:21 2009] [info] Init: Initializing (virtual) servers for SSL

[Mon Jul 06 10:28:21 2009] [info] mod_ssl/2.2.11 compiled against Server: Apache/2.2.11, Library: OpenSSL/0.9.8k

[Mon Jul 06 10:28:21 2009] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)

[Mon Jul 06 10:28:21 2009] [info] mod_unique_id: using ip addr 127.0.0.1

[Mon Jul 06 10:28:22 2009] [info] Init: Seeding PRNG with 144 bytes of entropy

[Mon Jul 06 10:28:22 2009] [info] Init: Generating temporary RSA private keys (512/1024 bits)

[Mon Jul 06 10:28:22 2009] [info] Init: Generating temporary DH parameters (512/1024 bits)

[Mon Jul 06 10:28:22 2009] [debug] ssl_scache_shmcb.c(253): shmcb_init allocated 512000 bytes of shared memory

[Mon Jul 06 10:28:22 2009] [debug] ssl_scache_shmcb.c(272): for 511920 bytes (512000 including header), recommending 32 subcaches, 133 indexes each

[Mon Jul 06 10:28:22 2009] [debug] ssl_scache_shmcb.c(306): shmcb_init_memory choices follow

[Mon Jul 06 10:28:22 2009] [debug] ssl_scache_shmcb.c(308): subcache_num = 32

[Mon Jul 06 10:28:22 2009] [debug] ssl_scache_shmcb.c(310): subcache_size = 15992

[Mon Jul 06 10:28:22 2009] [debug] ssl_scache_shmcb.c(312): subcache_data_offset = 3208

[Mon Jul 06 10:28:22 2009] [debug] ssl_scache_shmcb.c(314): subcache_data_size = 12784

[Mon Jul 06 10:28:22 2009] [debug] ssl_scache_shmcb.c(316): index_num = 133

[Mon Jul 06 10:28:22 2009] [info] Shared memory session cache initialised

[Mon Jul 06 10:28:22 2009] [info] Init: Initializing (virtual) servers for SSL

[Mon Jul 06 10:28:22 2009] [info] mod_ssl/2.2.11 compiled against Server: Apache/2.2.11, Library: OpenSSL/0.9.8k

[Mon Jul 06 10:28:22 2009] [info] mod_unique_id: using ip addr 127.0.0.1

[Mon Jul 06 10:28:23 2009] [debug] proxy_util.c(1801): proxy: loads of bla bla bla

[Mon Jul 06 10:28:23 2009] [notice] Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8k configured -- resuming normal operations

[Mon Jul 06 10:28:23 2009] [info] Server built: Jun 19 2009 11:50:55

[Mon Jul 06 10:28:23 2009] [debug] worker.c(1740): AcceptMutex: sysvsem (default: sysvsem)

```

----------

## gentoo-dev

 *eGore911 wrote:*   

> I think the log did not actually change. But here it is.
> 
> ```
> 
> [Mon Jul 06 10:28:20 2009] [info] Init: Seeding PRNG with 144 bytes of entropy
> ...

 

That is not the rewrite log

----------

## gentoo-dev

 *frenkel wrote:*   

> To sum things up, this should be the rewrite rule:
> 
> ```
> RewriteRule ^useless/(.*) $1 [PT,L] 
> 
> ...

 Can't check at the moment, but I believe this rule will never match anything. All your URLs will start with a /

----------

## eGore911

 *gentoo-dev wrote:*   

> Can't check at the moment, but I believe this rule will never match anything. All your URLs will start with a /

 

I changed my rewrite rule based on the input of frenkel. It had a "/" before.

 *gentoo-dev wrote:*   

> That is not the rewrite log

 

Yeah, that's the error_log which logging set to debugging. The rewrite_log is completely empty.

----------

## eGore911

Is there any simple way to make apache print out it's configuration that it will be using? I could not find any :-/

----------

## eGore911

 *eGore911 wrote:*   

> Is there any simple way to make apache print out it's configuration that it will be using? I could not find any :-/

 

I tried my luck with Apache::ConfigFile but that does not support wildcards in include file names which gentoos default setup relies on. I even patched it from an entry in their bug tracker but the result was not working either.

Now I'm trying my luck with Config::ApacheFormat  which does not support wildcards either, but I appended the files manally to httpd.conf.

----------

## eGore911

After hacking my own ugly dumper (far from complete or from sanity) I created to following diff between the (working) wine.txt.sorted and the non-working native.txt.sorted.

Any pointers would be helpful. Please note that the dumper currently cannot handle Proxy, Files, FilesMatch, Location, LimitExcept, Limit and Directory tags.

```

--- wine.txt.sorted   2009-07-17 19:07:34.000000000 +0200

+++ native.txt.sorted   2009-07-17 19:07:36.000000000 +0200

@@ -80,39 +99,71 @@

 AddLanguage sv .sv

 AddLanguage zh-CN .zh-cn

 AddLanguage zh-TW .zh-tw

+AddOutputFilter Includes html

 AddType application/x-compress .Z

 AddType application/x-gzip .gz .tgz

-Alias /icons/ "C:/Programme/Apache Group/Apache2/icons/"

-AliasMatch ^/manual(?:/(?:de|en|es|fr|ja|ko|ru))?(/.*)?$ "C:/Programme/Apache Group/Apache2/manual$1"

+AddType application/x-pkcs7-crl    .crl

+AddType application/x-x509-ca-cert .crt

+Alias /error/ "/var/www/localhost/error/"

+Alias /icons/ "/var/www/localhost/icons/"

+Alias /uploads "/var/www/uploads"

+Allow from 127.0.0.1

 Allow from all

 Allow from all

 Allow from all

 Allow from all

+Allow from all

+Allow from all

+AllowOverride FileInfo AuthConfig Limit Indexes

 AllowOverride None

 AllowOverride None

 AllowOverride None

 AllowOverride None

-AllowOverride None

+AuthName DAV-upload

+AuthType Digest

+AuthUserFile "/var/www/.htpasswd-dav"

 BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully

-BrowserMatch "^gnome-vfs" redirect-carefully

-BrowserMatch "Java/1\.0" force-response-1.0

-BrowserMatch "JDK/1\.0" force-response-1.0

+BrowserMatch "^gnome-vfs/1.0" redirect-carefully

 BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully

-BrowserMatch "Mozilla/2" nokeepalive

 BrowserMatch "MS FrontPage" redirect-carefully

-BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0

-BrowserMatch "RealPlayer 4\.0" force-response-1.0

-BrowserMatch "^WebDAVFS/1.[0123]" redirect-carefully

+BrowserMatch ".*MSIE.*" \

+BrowserMatch "^WebDAVFS/1.[012345678]" redirect-carefully

 BrowserMatch "^WebDrive" redirect-carefully

 BrowserMatch "^XML Spy" redirect-carefully

-CustomLog logs/access.log common

+CustomLog /var/log/apache2/access_log common

+CustomLog /var/log/apache2/ssl_request_log \

+Dav On

 DefaultIcon /icons/unknown.gif

 DefaultType text/plain

 Deny from all

+Deny from all

+Deny from all

+Deny from all

+DirectoryIndex cgit.cgi

 DirectoryIndex index.html index.html.var

-DocumentRoot "C:/Programme/Apache Group/Apache2/htdocs"

-ErrorLog logs/error.log

+downgrade-1.0 force-response-1.0

+ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var

+ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var

+ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var

+ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var

+ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var

+ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var

+ErrorDocument 410 /error/HTTP_GONE.html.var

+ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var

+ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var

+ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var

+ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var

+ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var

+ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var

+ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var

+ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var

+ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var

+ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var

+ErrorLog /var/log/apache2/error_log

+ErrorLog /var/log/apache2/ssl_error_log

 ForceLanguagePriority Prefer Fallback

+ForceLanguagePriority Prefer Fallback

+Group apache

 HeaderName HEADER.html

 HostnameLookups Off

 IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t

@@ -120,52 +171,120 @@

 KeepAlive On

 KeepAliveTimeout 15

 LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW

+LanguagePriority en cs de es fr it ja ko nl pl pt-br ro sv tr

+Listen 443

 Listen 80

-LoadModule access_module modules/mod_access.so

 LoadModule actions_module modules/mod_actions.so

 LoadModule alias_module modules/mod_alias.so

-LoadModule asis_module modules/mod_asis.so

-LoadModule auth_module modules/mod_auth.so

+LoadModule auth_basic_module modules/mod_auth_basic.so

+LoadModule authn_alias_module modules/mod_authn_alias.so

+LoadModule authn_anon_module modules/mod_authn_anon.so

+LoadModule authn_dbm_module modules/mod_authn_dbm.so

+LoadModule authn_default_module modules/mod_authn_default.so

+LoadModule authn_file_module modules/mod_authn_file.so

+LoadModule authz_dbm_module modules/mod_authz_dbm.so

+LoadModule authz_default_module modules/mod_authz_default.so

+LoadModule authz_groupfile_module modules/mod_authz_groupfile.so

+LoadModule authz_host_module modules/mod_authz_host.so

+LoadModule authz_owner_module modules/mod_authz_owner.so

+LoadModule authz_user_module modules/mod_authz_user.so

 LoadModule autoindex_module modules/mod_autoindex.so

-LoadModule cgi_module modules/mod_cgi.so

+LoadModule cgid_module modules/mod_cgid.so

+LoadModule deflate_module modules/mod_deflate.so

 LoadModule dir_module modules/mod_dir.so

 LoadModule env_module modules/mod_env.so

-LoadModule imap_module modules/mod_imap.so

+LoadModule expires_module modules/mod_expires.so

+LoadModule ext_filter_module modules/mod_ext_filter.so

+LoadModule filter_module modules/mod_filter.so

+LoadModule headers_module modules/mod_headers.so

 LoadModule include_module modules/mod_include.so

-LoadModule isapi_module modules/mod_isapi.so

+LoadModule info_module modules/mod_info.so

 LoadModule log_config_module modules/mod_log_config.so

+LoadModule logio_module modules/mod_logio.so

+LoadModule mime_magic_module modules/mod_mime_magic.so

 LoadModule mime_module modules/mod_mime.so

 LoadModule negotiation_module modules/mod_negotiation.so

+LoadModule proxy_balancer_module modules/mod_proxy_balancer.so

+LoadModule proxy_connect_module modules/mod_proxy_connect.so

+LoadModule proxy_ftp_module modules/mod_proxy_ftp.so

+LoadModule proxy_http_module modules/mod_proxy_http.so

+LoadModule proxy_module modules/mod_proxy.so

+LoadModule rewrite_module modules/mod_rewrite.so

 LoadModule setenvif_module modules/mod_setenvif.so

+LoadModule speling_module modules/mod_speling.so

+LoadModule ssl_module modules/mod_ssl.so

+LoadModule substitute_module modules/mod_substitute.so

+LoadModule suexec_module modules/mod_suexec.so

+LoadModule unique_id_module modules/mod_unique_id.so

 LoadModule userdir_module modules/mod_userdir.so

+LoadModule usertrack_module modules/mod_usertrack.so

+LoadModule vhost_alias_module modules/mod_vhost_alias.so

 LogFormat "%h %l %u %t \"%r\" %>s %b" common

 LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

+LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

 LogFormat "%{Referer}i -> %U" referer

-LogFormat "%{User-agent}i" agent

-LogLevel warn

+LogFormat "%{User-Agent}i" agent

+LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" vhostio

+LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" VLOG=%{VLOG}e" vhost

+LogFormat "%v %h %l %u %t \"%r\" %>s %b %T" script

+LogLevel debug

 MaxKeepAliveRequests 100

+MIMEMagicFile /etc/apache2/magic

+NameVirtualHost *:80

+nokeepalive ssl-unclean-shutdown \

+Options ExecCGI

+Options +ExecCGI

 Options FollowSymLinks

-Options Indexes

-Options Indexes FollowSymLinks

+Options IncludesNoExec

 Options Indexes MultiViews

-Options None

+Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec

+Order allow,deny

 Order allow,deny

 Order allow,deny

 Order allow,deny

 Order allow,deny

 Order allow,deny

-PidFile logs/httpd.pid

+Order deny,allow

+Order deny,allow

+Order deny,allow

+Order deny,allow

+PidFile /var/run/apache2.pid

+ProxyPass /test http://localhost:8080/test

+ProxyRequests On

+ProxyVia On

 ReadmeName README.html

-RedirectMatch 301 ^/manual(?:/(de|en|es|fr|ja|ko|ru)){2,}(/.*)?$ /manual/$1$2

-ScriptAlias /cgi-bin/ "C:/Programme/Apache Group/Apache2/cgi-bin/"

-ServerAdmin admin@localhost

-ServerName localhost:80

-ServerRoot "C:/Programme/Apache Group/Apache2"

+require user admin

+RewriteEngine On

+RewriteLogLevel 3

+RewriteLog "/var/log/apache2/rewrite_log"

+RewriteRule ^useless/(.*) /${1} [PT,L]

+ServerEnvironment apache apache

+ServerName localhost

+ServerName localhost

+ServerRoot "/usr/lib64/apache2"

 ServerSignature On

-ServerTokens Full

-SetEnvIf Request_URI ^/manual/(de|en|es|fr|ja|ko|ru)/ prefer-language=$1

-SetHandler type-map

+ServerTokens Prod

+SetHandler cgi-script

+SetHandler server-info

+SSLCertificateFile /etc/apache2/ssl/server.crt

+SSLCertificateKeyFile /etc/apache2/ssl/server.key

+SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL

+SSLEngine on

+SSLMutex  file:/var/run/ssl_mutex

+SSLOptions +StdEnvVars

+SSLOptions +StdEnvVars

+SSLPassPhraseDialog  builtin

+SSLRandomSeed connect builtin

+SSLRandomSeed startup builtin

+SSLSessionCache         shmcb:/var/run/ssl_scache(512000)

+SSLSessionCacheTimeout  300

+"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

 Timeout 300

-TypesConfig conf/mime.types

+TraceEnable off

+TransferLog /var/log/apache2/ssl_access_log

+TypesConfig /etc/mime.types

 UseCanonicalName Off

-UserDir "My Documents/My Website"

+User apache

+UserDir public_html

```

----------

## jd2066

I just had the same problem with global rewrite rules so I checked out the documentation at http://httpd.apache.org/docs/2.2/mod/mod_rewrite.htm and it said:

 *Quote:*   

> By default, mod_rewrite configuration settings from the main server context are not inherited by virtual hosts. To make the main server settings apply to virtual hosts, you must place the following directives in each <VirtualHost> section:
> 
> RewriteEngine On
> 
> RewriteOptions Inherit 

 

So I added the following to the top of /etc/apache2/vhosts.d/default_vhost.include and the rules worked:

```
# mod_rewrite options

RewriteEngine On

RewriteOptions Inherit

```

----------

