Answer the question
In order to leave comments, you need to log in
Mod_rewrite not working for just one VirtualHost?
There are several absolutely identical virtual hosts. Here is their config of two of them:
<Directory "/home/user/">
Options Indexes FollowSymLinks MultiViews Includes
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<VirtualHost *:80>
DocumentRoot /home/user/hostA/www
CustomLog /home/user/hostA/logs/access.log combined
ErrorLog /home/user/hostA/logs/error.log
ScriptAlias /cgi-bin/ "/home/user/hostA/cgi-bin/"
ServerName www.hostA.ru
ServerAlias hostA.ru
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /home/user/hostB/www
CustomLog /home/user/hostB/logs/access.log combined
ErrorLog /home/user/hostB/logs/error.log
ScriptAlias /cgi-bin/ "/home/user/hostB/cgi-bin/"
ServerName www.hostB.ru
ServerAlias hostB.ru
</VirtualHost>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.html [QSA,L]
RewriteLog /home/user/hostB/logs/rewrite.log
RewriteLogLevel 3
Answer the question
In order to leave comments, you need to log in
I decided as follows: I made a new DocumentRoot for HostB, began to copy files there from the old directory one by one. It turned out that for some unknown reason, the .xsl style file, which was hanging in the root of the site and was not even connected anywhere, leads to an error. Very strange. It's time to start the tambourine :)
hmm, try swapping the descriptions of hostA and hostB.
in /home/user/hostB/ is there any .htaccess by any chance?
no, there are no more .htaccess-s. Moreover, the problem started after the Apache upgrade. Before that everything worked. HostaB files were not touched.
Here mod_rewrite wrote the level 2 log:
127.0.0.1 - - [03/Jul/2012:18:30:13 +0400] [hostB.ru/sid#80bff70][rid#8245ac0/initial] (2) [perdir /home/user/hostB/www/] rewrite 'hostB/p/square.gif' -> 'index.html'
127.0.0.1 - - [03/Jul/2012:18:30:13 +0400] [hostB.ru/sid#80bff70][rid#8245ac0/initial] (2) [perdir /home/user/hostB/www/] strip document_root prefix: /home/user/hostB/www/index.html -> /index.html
127.0.0.1 - - [03/Jul/2012:18:30:13 +0400] [hostB.ru/sid#80bff70][rid#8245ac0/initial] (1) [perdir /home/user/hostB/www/] internal redirect with /index.html [INTERNAL REDIRECT]
127.0.0.1 - - [03/Jul/2012:18:30:13 +0400] [hostB.ru/sid#80bff70][rid#8256ac0/initial/redir#1] (1) [perdir /home/user/hostB/www/] pass through /home/user/hostB/www/index.html
127.0.0.1 - - [03/Jul/2012:18:30:13 +0400] [hostB.ru/sid#80bff70][rid#8258b08/subreq] (1) [perdir /home/user/hostB/www/] pass through /home/user/hostB/www/index.html
The same problem arose. The difference between sites in domains, username, group and in the way of loading. I uploaded everything to the first site via ftp, to the second one via sftp. The rest is completely identical, the configs were created by the script, no differences at all.
Through sftp, the Russian file names were broken (a few pieces, not critical) and that's all I've noticed so far. Those. the file names were written incorrectly and mod-rewrite does not work, but this should not be related, I have no idea where to dig yet.
All similar actions were repeated many times under debian 6, no problems arose. This server is under debian 7.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question