Forum Moderators: phranque
The directory structure is the follow:
/var/www/
--->www.example.com
------>pkhg_www
--------->modules
------>pkhg_utente1
--->www.example.org
I'll explain the draft above better. Inside my DocumentRoot (/var/www) there are two folders, one for the domain www.example.com, the other for the domain www.mio_dominio.org. The site associated to the domain www.mio_dominio.org is very simple (some static web pages) while the site associated to the domain www.example.com is more complicated. This domain contains third level domains: www, user1, user2....
The content of the subdomain 'www' is in the subfolder 'pkhg_www', the content of the subdomain 'user1' is in the subfolder 'pkhg_user1'...
In the subfolder 'pkhg_www' there's PHP code of my portal (a virtual community) while in the others subdomains (user1, user2, ...) there are the blogs of the users of my community. In the subfolder 'pkhg_www' there's a folder named 'modules'.
If I point my browser to:
http://www.example.com/index.htm
all right
If I point my browser to:
http://user1.example.com/index.htm
all right
Instead if I point my browser to:
http://www.example.com/modules/index.html
the browser shows 'Not found' page. But this page exists!
I think there are problems about Rules of rewrite Apache module but I'm not able to fix them...I'm not skilled about regular expression.....
This is my /etc/apache2/sites-available/www.example.com:
<VirtualHost *>
ServerName www.example.com
ServerAlias www.example.com *.example.com
DocumentRoot /var/www/www.example.com
RewriteEngine on
RewriteLogLevel 9
RewriteLog "rewrite.log"
#RewriteCond %{HTTP_HOST} ^forum\.example\.com
#RewriteCond %{REQUEST_URI} !^/forum/?
#RewriteRule ^/(.*)$ /forum/$1 [L]
RewriteCond %{REQUEST_URI} !^/pkhg_
RewriteCond %{HTTP_HOST} ^(www\.)?([^.]+)\.example\.com
RewriteRule ^/(.*)$ /pkhg_%2/$1 [L]
<Directory /var/www/www.example.com>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Thanks a lot!
[edited by: jdMorgan at 3:36 pm (utc) on April 21, 2006]
[edit reason] example.com [/edit]
What entries do you see in your rewrite.log file and in your server error log?
For more information on regular expressions and mod_rewrite, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].
Jim