.htaccess rewrite not working

Ok I’ve put exactly what you have into my .htaccess file, its the only code thats in it now, gone to http://www.mysite.com/test.php and I now get an internal server error?

I think the mod is installed and enabled because I got the test form the link you gave me to work earlier. This worked:
RewriteEngine on
RewriteRule ^test\.html$ test.php [L]

I don’t understand whats wrong with it :frowning:

  • rubs dust out of his eyes *

try this:


RewriteEngine on
RewriteRule ^([a-zA-Z[B]0-9[/B]_]+)/([a-zA-Z[B]0-9[/B]_]+)/([a-zA-Z[B]0-9[/B]_]+)/$ details.php?make=$1&model=$2&year=$3 [L]

Cool, we’re getting there I think, I’m now getting through to the details page but the url shows as /BMW/G650/2007/

Problem now is that none of the actual data from the db is pulling into that file because I’m missing the Id variable that is used on the details page to pull in the correct data. How do I get that to pull through?

You are fantastic for being so patient with me and helping to fix this. Really appreciate it.

You can either put the id in the URL itself, like /<id>/BMW/G650/2007/ (or in another spot of course), or change the query in your app such that it doesn’t need the id anymore but can use the information provided in the URL.
In your case that would mean that make, model, and year together should be a UNIQUE key in the database.

Cool I got that to work!!! Only thing is is there anyway I can take the id number out of the url?

(see my previous post)

Got it all sorted now!
I can’t thank you enough for all the help with this today.

I’m going to try this on a much more complicated site now to see if I can get that to work. :slight_smile:

Good luck and feel free to come back here if you have any questions :slight_smile: