Hi Deb,

> Unfortunately, there doesn't appear to be a
> tutorial in the world that's going to help me
> figure this out on my own.

The way I get clean URLs using rewriting is to have everything pointing at
one central script, which then parses the URL and includes other files as
necessary. I like this, because you have all your code in one place, and
then lots of little bits of content (which can be flat files, or in a
database, or anything) - it's like the ultimate SSI :-)

I can have a go at explaining it, but I'm not sure how well I'll do.

The .htaccess stuff is just three lines. Firstly, you need to tell Apache to
listen to you:

  RewriteEngine on

Secondly, you need to set up a "passthrough" rule so that things like
images, stylesheets, javascripts and so on don't get rewritten:

  RewriteRule \.(gif|jpg|css|js)$ - [L]

There are four bits to this line, separated with spaces:

1. "RewriteRule" - this tells Apache we're defining a new rule.

2. "\.(gif|jpg|css|js)$" - this tells it which files to apply this rule to.
This a regular expression which says "any file that ends in a dot followed
by gif, jpg, css, or js". You can add more extensions here if you like (word
documents, pdfs, etc).

3. "-" means "do nothing with these files" (this is the passthrough bit)

4. "[L]" means "ignore any further rewriting rules".

The third line in your .htaccess is the one that actually does the
rewriting. It takes the same format as the passthrough rule:

  RewriteRule ^foo/.*$ /path/to/httpdocs/foo/index.php [L]

Again, there are four bits:

1. "RewriteRule" - same as before.

2. "^foo/.*$" means "any request for a file in the /foo directory"

3. "/path/to/httpdocs/foo/index.php" means "redirect these requests to
/path/to/httpdocs/foo/index.php" - this would be the central script that
chops up the URL and works out what's going on. You'll need to change this
to the correct path for the script.

4. "[L]" - same as before.

Once you have these three lines in your .htaccess, any request beginning
with www.yoursite.whatever/foo/ will be rewritten to /foo/index.php, which
needs to split the URL up and then do whatever's needed (I have PHP code for
this if you want it).

If you can show us what you've done so far, and what error messages you got,
that would be really useful :-)

Cheers
Jon


____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] 
       Send Your Posts To: [EMAIL PROTECTED]
To change subscription settings to the wdvltalk digest version:
    http://wdvl.internet.com/WDVL/Forum/#sub

________________  http://www.wdvl.com  _______________________

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to