Click to See Complete Forum and Search --> : Proper way to use .htaccess and php


harleyflh75
04-04-2008, 07:58 PM
I have been working on this project for a few months now. it is similar to a cms and have most of it done except for SEF urls.

every page I have starting out with index.php that includes my session start, classes, config variables, templates with css et al.
an example of a link would be:
example.com/index.php?content=shop&task=viewcart&id=3
or
example.com/index.php?content=frontpage
plus there could be any number of POST variables

What would be the proper way to make this SEF?
1. for example this is a form action:

<form action="index.php?content=shop&category=<?php echo $_GET['category']; ?>" method="post" enctype="application/x-www-form-urlencoded" name="addtoCart">

Do I take this url of example.com/index.php?content=shop&category=2 and change it with a function to say example.com/shop/2 (or the name) then mod rewrite in htaccess back to example.com/index.php?content=shop&category=2. so it shows in the browser as /shop/2. and also do i retain all my POST variables.
2. Is it the oposite way to make this happen.
3. Am I totally off base with this mod rewrite.
Every site I have tried to find the answer is either geared toward Joomla SEF or just talks about the htaccess and not what to do prior to that.

as far as me using index.php everytime this is how this project started out. version 2.? will be different since I have learned classes since I started it.

I know this is probably hard to understand so it might be easier to answer individual questions.

Thanx in advance for the help.

dclamp
04-05-2008, 12:48 AM
well a search engine friendly URL looks something like:

index.php/category/shoes/green/123/comment
(just example)

http://www.sitepoint.com/article/search-engine-friendly-urls

that shows how to make SEF URLs (also is a SEF URL)

dclamp
04-05-2008, 12:57 AM
i miss read your post and was going to edit my post but it was delete :o

im not sure if this can be done in .htaccess but i will look for you.

bigajosep
04-24-2008, 11:32 AM
I have the exact same question as the original poster.

Am I destined to dissect osCommerce or worpress to learn how to do URL caching and SEF URLs or does anyone have other suggestions to learn how to do this?

bigajosep
04-26-2008, 11:50 PM
i found a book on amazon called something like search engine optimization with php that looks like it would help.
I started disecting oscommerce and now im gonna wait for the book to arrive because disecting oscommerce suks