[STILL NOT WORKING] Dynamic RewriteRule based on the URL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,
Sometimes back I posted this message, asking if there is a way to get
http://folder.domain.tld to point to a /home/users/folder - well this is
just a simplification of the request - but I still have not found a way
to get this to work... here is a link to the original post.

http://mail-archives.apache.org/mod_mbox/httpd-users/200609.mbox/date

Post title ' Dynamic RewriteRule based on the URL'

Well, now I have a bit of time, I though I tackle this again, so I
started from basics ;) First tried to get the example to work from

http://httpd.apache.org/docs/2.2/misc/rewriteguide.html - for Virtual
Users Hosts

here is my httpd.conf

<VirtualHost *:80>
  ServerName rewrite.example
  ServerAdmin khinester
  RewriteEngine on
  RewriteCond   %{HTTP_HOST}                 ^[^.]+\.rewrite\.example$
  RewriteRule   ^(.+)                        %{HTTP_HOST}$1          [C]
  RewriteRule   ^([^.]+)\.rewrite\.example(.*)
/Users/khinester/Sites/destinations/$1$2
  RewriteLog /tmp/rewrite.log
  RewriteLogLevel 9
  ErrorLog       /tmp/rewrite_example_log
</VirtualHost>

in my /etc/hosts i have the following two entries:


127.0.0.1 rewrite.example
127.0.0.1 london.rewrite.example


Now when I go to http://rewrite.example I get my root Apache page, this
is correct as I have not specified anywhere else to point this at -
perhaps this may be the problem?

Then when I go to http://london.rewrite.example - I get a 502 Bad
Gateway error

Here is the rewrite.log output

127.0.0.1 - - [09/Mar/2007:13:08:56 +0100]
[rewrite.example/sid#188ae08][rid#1975450/initial] (3) applying pattern
'^(.+)' to uri '/favicon.ico'
127.0.0.1 - - [09/Mar/2007:13:08:56 +0100]
[rewrite.example/sid#188ae08][rid#1975450/initial] (4) RewriteCond:
input='rewrite.example' pattern='^[^.]+\.rewrite\.example$' => not-matched
127.0.0.1 - - [09/Mar/2007:13:08:56 +0100]
[rewrite.example/sid#188ae08][rid#1975450/initial] (1) pass through
/favicon.ico
127.0.0.1 - - [09/Mar/2007:13:08:56 +0100]
[rewrite.example/sid#188ae08][rid#1975450/initial] (2) init rewrite
engine with requested uri /favicon.ico
127.0.0.1 - - [09/Mar/2007:13:08:56 +0100]
[rewrite.example/sid#188ae08][rid#1975450/initial] (3) applying pattern
'^(.+)' to uri '/favicon.ico'
127.0.0.1 - - [09/Mar/2007:13:08:56 +0100]
[rewrite.example/sid#188ae08][rid#1975450/initial] (4) RewriteCond:
input='rewrite.example' pattern='^[^.]+\.rewrite\.example$' => not-matched
127.0.0.1 - - [09/Mar/2007:13:08:56 +0100]
[rewrite.example/sid#188ae08][rid#1975450/initial] (1) pass through
/favicon.ico

On my machine, /Users/khinester/Sites/destinations has the following
structure

index.html
|-- london
|   |-- images
|   |-- index.html
|-- liverpool
|   |-- images
|   |-- index.html


....


So I was hoping that if I type http://london/rewrite.example to see the
london/index.html page - which is not the case ;(

I don't see what I am doing wrong here, any pointers much appreciated.

Cheers

Norman



-- 
Norman Khine



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux