Hi out there!
I got a strange problem with my apache. For lots of weeks everything went
fine. But a few days ago I encountered some errors. The heaviest seems to be
that the mod_rewrite does not work properly ... and I've had a lot of work
to get it up and running ages ago.
Perhaps it hangs because I rearranges my vhosts a few weeks ago - but I
don't think that these two things depend on eachother (?).
I don't know what to do, I tested several settings, but none of my
RewriteRules is executed. Perhaps some of you could briefly browse through
the snippets of my config files and give me one or more hint(s)? I would be
very glad ...
Thanks in advance!
Bjoern
Output from "apachectl fullstatus":
----- 8< -----
Server Version: Apache/1.3.19 (Unix) (SuSE/Linux) ApacheJServ/1.1.2
mod_layout/1.0 mod_throttle/3.0 mod_fastcgi/2.2.2 mod_ssl/2.8.3
OpenSSL/0.9.6a PHP/4.0.6 mod_perl/1.25 mod_dtcl
Server Built: Oct 21 2002 10:31:55
----- >8 -----
/etc/httpd/httpd.conf:
----- 8< -----
[...]
LoadModule rewrite_module /usr/lib/apache/mod_rewrite.so
[...]
AddModule mod_rewrite.c
[...]
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteLog /var/log/httpd/rewrite_log
## Just for debugging - normally switched to "3"
RewriteLogLevel 7
## This is to redirect all requests searching for M$-related security
holes
## to the people who should handle them correctly ...
RewriteCond %{REQUEST_URI}root\.exe [NC,OR]
RewriteCond %{REQUEST_URI}cmd\.exe [NC,OR]
RewriteCond %{REQUEST_URI}default\.ida [NC]
RewriteRule ^/(.*)$
http://www.microsoft.com/$1?%{QUERY_STRING}
[R=301,L]
## If someone forgets the trailing /
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+[^/])$ $1/ [R]
## This is to read requests for pages without any subdomain from the
## correct directory
RewriteCond %{SERVER_NAME}^([^.]+)\.([^.]+)$ [NC]
RewriteRule ^/(.*)$ /www/%2/%1/htdocs/$1?%{QUERY_STRING}
## Every vhost on my machine should have a subdomain named "webmail"
## to reach the qmail webmail pages ... the following directives are
needed for this
RewriteCond %{SERVER_NAME}^webmail\..+ [NC]
RewriteRule ^/images/(.*)$
http://my.ip.add.ress/images/$1 [P,L]
RewriteCond %{SERVER_NAME}^webmail\..+ [NC]
RewriteRule ^/admin(.*)$
http://my.ip.add.ress/cgi-bin/qmailadmin$1?%{QUERY_STRING} [P,L]
RewriteCond %{SERVER_NAME} ^webmail\..+ [NC]
RewriteRule ^/(.*)$
http://my.ip.add.ress/cgi-bin/sqwebmail$1?%{QUERY_STRING} [P,L]
</IfModule>
[...]
<VirtualHost _default_:*>
ServerName my.servername.tld
ServerAdmin webmaster RemoveThis @servername.tld
DocumentRoot "/usr/local/httpd/htdocs"
ErrorLog /var/log/httpd/error_log
CustomLog /var/log/httpd/access_log combined
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteOptions inherit
</IfModule>
</VirtualHost>
Include /etc/httpd/vhost.conf
[...]
----- >8 -----
/etc/httpd/vhost.conf:
----- 8< -----
[...]
<VirtualHost my.ip.add.ress>
ServerName vhostdomain.tld
ServerAlias *.vhostdomain.tld
ServerAdmin webmaster RemoveThis @vhostdomain.tld
DocumentRoot "/usr/local/httpd/vhosts/tld/vhostdomain/www/htdocs"
VirtualDocumentRoot "/usr/local/httpd/vhosts/%-1/%-2/%-3+/htdocs"
ErrorLog "/usr/local/httpd/vhosts/tld/vhostdomain/error_log"
CustomLog "/usr/local/httpd/vhosts/tld/vhostdomain/access_log" combined
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteOptions inherit
## This rule should redirect requests like "/stuff/1.html" to
"/index.php?show=1"
## and something like "/stuff/more_info.html?some=vars&more=vars" to
## "/index.php?show=more_info&some=vars&more=vars" ... works
perfectly (local)
RewriteRule ^/stuff/(.+)\.html$
http://www.vhostdomain.tld/index.php?show=$1&%{QUERY_STRING} [P,L]
## And now a special case ... all this is to make my site more
search engine friendly
RewriteRule ^/pictures\.html$
http://www.vhostdomain.tld/index.php?menu=6&%{QUERY_STRING} [P,L]
</IfModule>
</VirtualHost>
[...]
----- >8 -----