This is a discussion on Mod_rewrite within the Apache Web Server forums, part of the Web Server and Related Forums category; Hi, I am currently running Apache 1.3.27 with Debian Woody and I am looking to setup an easy ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
I am currently running Apache 1.3.27 with Debian Woody and I am looking to setup an easy virtual host solution. I am using mod_vhost_alias at the moment but I would prefer to use mod_rewrite as it offers more flexibility. However I am having problems and I would appreciate anybody's thoughts and ideas. I currently have (based on the code from the Apache docs): ---------- RewriteEngine on RewriteMap lowercase int:tolower RewriteMap vhost txt:/xxx/xxxxx/vhost.map RewriteCond %{REQUEST_URI} !^/icons/ RewriteCond %{REQUEST_URI} !^/cgi-bin/ RewriteCond %{REQUEST_URI} !^/webmail/ RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$ RewriteCond ${vhost:%1} ^(/.*)$ RewriteRule ^/(.*)$ %1/public_html/$1 RewriteCond %{REQUEST_URI} ^/cgi-bin/ RewriteCond %{HTTP_HOST} !^$ RewriteCond ${lowercase:%{HTTP_HOST}} ^(.+)$ RewriteCond ${vhost:%1} ^(/.*)$ RewriteRule ^/(.*)$ %1/cgi-bin/$1 ---------- The virtual hosts are litsted in vhost.map as: ---------- domain.com /home/website1 ---------- The rewrite works when the domain is referenced as "domain.com" however www.domain.com produces a 404 (points to /usr/htdocs). My question is, how can I take into account the www? Also, I have been considering upgrading to Apache 2.0.48 which I now believe is recommended for production. However what is the status of the interoperability with PHP? I have read on the PHP site that it is not recommended to run Apache 2.0 with PHP but does this refer to the latest revisions or the initial release? Many thanks in advance, MB |
|
|||
|
Matthew Bates wrote:
> The rewrite works when the domain is referenced as "domain.com" however > www.domain.com produces a 404 (points to /usr/htdocs). > > My question is, how can I take into account the www? The simplist way would be to remove the www. at the very start. This is untested: RewriteRule www\.(.*) $1 Alternately, add a duplicate entry but with the www. in your vhost mapping. > Also, I have been considering upgrading to Apache 2.0.48 which I now believe > is recommended for production. However what is the status of the > interoperability with PHP? I have read on the PHP site that it is not > recommended to run Apache 2.0 with PHP but does this refer to the latest > revisions or the initial release? I don't recommend upgrading to 2.x. There are a lot of modules that have not been ported to the 2.x branch at this time. -- Rossz |
|
|||
|
Thanks for your reply.
I now have the following, however it is not working. I would be grateful if someone could explain the process (e.g. rules/conditions) and what may be wrong here? --------- RewriteEngine on RewriteMap lowercase int:tolower RewriteMap vhost txt:/xxx/xxxxx/vhost.map RewriteCond %{REQUEST_URI} !^/icons/ RewriteCond %{REQUEST_URI} !^/cgi-bin/ RewriteCond %{REQUEST_URI} !^/webmail/ RewriteRule www\.(.*) $1 RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$ RewriteCond ${vhost:%1} ^(/.*)$ RewriteRule ^/(.*)$ %1/public_html/$1 RewriteCond %{REQUEST_URI} ^/cgi-bin/ RewriteCond %{HTTP_HOST} !^$ RewriteCond ${lowercase:%{HTTP_HOST}} ^(.+)$ RewriteCond ${vhost:%1} ^(/.*)$ RewriteRule ^/(.*)$ %1/cgi-bin/$1 --------- Thanks, Matthew "Rossz" <rosszNOSPAM@vamos-wentworth.org> wrote in message news:nvtOb.12757$W%3.6130@newssvr27.news.prodigy.c om... > Matthew Bates wrote: > > > The rewrite works when the domain is referenced as "domain.com" however > > www.domain.com produces a 404 (points to /usr/htdocs). > > > > My question is, how can I take into account the www? > > The simplist way would be to remove the www. at the very start. This is > untested: > > RewriteRule www\.(.*) $1 > > Alternately, add a duplicate entry but with the www. in your vhost mapping. > > > Also, I have been considering upgrading to Apache 2.0.48 which I now believe > > is recommended for production. However what is the status of the > > interoperability with PHP? I have read on the PHP site that it is not > > recommended to run Apache 2.0 with PHP but does this refer to the latest > > revisions or the initial release? > > I don't recommend upgrading to 2.x. There are a lot of modules that > have not been ported to the 2.x branch at this time. > > -- > Rossz |