Page 1 of 1

Rewrtite again...

PostPosted: 01. December 2006 23:59
by tomwerner
Hi,

I am having some problems getting rewriting working (Apache really hates me with this - I have had so many problems on hosted accounts aswell!).

Anyway - I have uncommented the Loadmodule directive and verified it is loaded using phinfo(). I have also changed AllowOverride to All.

I am trying a really basic rewrite to transform pretty urls into a dynamic urls like so:

RewriteEngine On
RewriteRule ^/products$ ^/content.php
RewriteRule ^/sn2/products/([0-9]+)$ ^/content.php?id=$1

content.php is in the same folder as the .htaccess file, sn2 is a folder directly under apache root.

I get a 404 error when using an internet browser to navigate to http://localhost/sn2/products/9.

Looking in the error log it says:

[Fri Dec 01 22:49:23 2006] [error] [client 127.0.0.1] File does not exist: E:/xampplite/htdocs/sn2/products


Any ideas? Or am i cursed forever?

Cheers - Tom

PostPosted: 02. December 2006 00:09
by Wiedmann
a) RewriteRules (the regex part), used in a ".htaccess", can't start with a slash (/).

b) if you have problems with mod_rewrite, enable the rewrite.log (LogLevel 6) and read it.

Re: Rewrtite again...

PostPosted: 02. December 2006 00:17
by Izzy

PostPosted: 02. December 2006 08:47
by tomwerner
Cheers people - I walked in blind to that one - just followed a tutorial on it and they used slashes! Took them out and it worked fine - Thanks!!

Cheers for the help,

Tom