Greetings to everyone. I'm new at this forum and also new to programming in php.
I posted my first website on another forum for review and everyone said it was sh*t and they were true. One of the bad things are urls and links. I used $_get in urls which was bad for seo.
Now I'm learning how to rewrite urls with .htaccess for the past 7 days and still don't get it.
I've learned regular expressions (at least the parts that i need) and I've managed to redirect to other scripts that don't have GET paramaters atached to it, but with GET i can't and don't understand. I've read all the forum threads, stackoverflow posts and .htaccess tutorials and tried .htaccess generators (who i don't want to use beacuse i want to learn) but still don't get it.
This is my problem.
I have a website that has a product list. In the product list, there is a link for 'Details' on a product. The url is constructed from data fetched from a database like a name and an id so i could access the data in the file that the url points to. The link is as follows
Now, this link is in index.php, the starting document.
The file i which to be redirected is products.php?id=12 or some other id number. It depends on the product id fetched from the database.
So i wrote the rule like this...
RewriteRule ^Article-([a-zA-Z])/([0-9]+)/? products.php?id=$1
So, the url has two parts. The first is the name of the product that has to be in url. The name of the product is known by the 'Article-', then a regular expression for the actual name. Then, the id. Now, this works. Lets say my products name is 'Coffie' and id is 56. My url gets rewritten to www.example.com/Article-Coffie/56 but 404 error arises. The server can't find products.php. Why?
All the help is welcome.
Thank you in advance.