Jim
Wed 20 May 2009, 03:02 pm GMT +0200
Hello all,
I'm currently setting up my server to host a website that generates URLs on the fly. I've inserted this code into my .httpd file. This code rewrites each request and finds the correct folder. The snippet of code is:
<VirtualHost 192.168.0.6:3128>
<Directory "/var/www/">
Options Indexes FollowSymLinks
AllowOverride none
Order allow,deny
Allow from all
</Directory>
ServerName site1.local
DocumentRoot /var/www/
RewriteEngine on
RewriteMap lowercase int:tolower
RewriteCond ${lowercase:%{SERVER_NAME}} ^[a-z0-9-]+.[.a-z0-9-]+$
RewriteRule ^(.+) ${lowercase:%{SERVER_NAME}}$1 [C]
RewriteRule ^([a-z0-9-]+).([a-z0-9-.]+)/(.*) /var/www/$2/$1/$3
</VirtualHost>
However, whenever I run index.php I get this error message:
The requested URL /index.php was not found on this server.
I've checked my error log and found that Apache adds a folder onto my URL. Here is an exert from my error log:
[error] [client 192.168.0.6] File does not exist: C:/var/www/var
As you can see it has added the folder 'var' onto the end of my root. Therefore when my server looks for index.php it can't find it. I need to keep the code that instructs apache to re-write each incoming request to find the right folder for it, but how do I stop it adding a new folder onto the end? I'm quite new to the mod_rewrite function so any help would be great.
Jim.
I'm currently setting up my server to host a website that generates URLs on the fly. I've inserted this code into my .httpd file. This code rewrites each request and finds the correct folder. The snippet of code is:
<VirtualHost 192.168.0.6:3128>
<Directory "/var/www/">
Options Indexes FollowSymLinks
AllowOverride none
Order allow,deny
Allow from all
</Directory>
ServerName site1.local
DocumentRoot /var/www/
RewriteEngine on
RewriteMap lowercase int:tolower
RewriteCond ${lowercase:%{SERVER_NAME}} ^[a-z0-9-]+.[.a-z0-9-]+$
RewriteRule ^(.+) ${lowercase:%{SERVER_NAME}}$1 [C]
RewriteRule ^([a-z0-9-]+).([a-z0-9-.]+)/(.*) /var/www/$2/$1/$3
</VirtualHost>
However, whenever I run index.php I get this error message:
The requested URL /index.php was not found on this server.
I've checked my error log and found that Apache adds a folder onto my URL. Here is an exert from my error log:
[error] [client 192.168.0.6] File does not exist: C:/var/www/var
As you can see it has added the folder 'var' onto the end of my root. Therefore when my server looks for index.php it can't find it. I need to keep the code that instructs apache to re-write each incoming request to find the right folder for it, but how do I stop it adding a new folder onto the end? I'm quite new to the mod_rewrite function so any help would be great.
Jim.