Code:
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*)\.html$ fetch.php?id=$1
Well, I'd prefer to NEVER see (.*) (unless you mean to capture either everything or nothing) as you could use ([0-9]+) for digits or ([a-z]+) for lowercase letters - meaning that it will not match /'s, .'s, A-Z's, etc. If a hacker includes "malicious code", you won't match <script ... yadda-yadda> in your id string. Learn to code defensively so you lower the odds of a successful hack attack.
I have this in my htaccess file and it works fine, but I want to know if there is a way to rewrite this so that instead of just pulling the id # i can pull the category and title up instead or will i need to do something like this
Code:
RewriteRule (.*)/(.*)/(.*)\.html$ fetch.php?id=$1&category=$2&title=$3
# Why not:
# RewriteRule ([0-9]+)/([a-zA-Z]+)/([a-zA-Z_\ ]+)\.html$ fetch.php?id=$1&category=$2&title=$3 [L]
# That would REQUIRE that the if value be an integer, The value of category be one or more letters and title be one or more letters, _'s and/or spaces
With this method I can pull the necessary information up but the url can't be written how I want it to look. with the method above I get something very long.
Very long? Is that a concern? If so, then use a shorter category name and title! ... OR the sticky thread which was developed from an earlier version of the tutorial.

Also if this is what I need to do, how will I go about changing my title to have no spaces and only have dashes inbetween them? I heard that urls don't like spaces. I have read somewhere else they used a php code where the spaces were turned into "-" or "_" to be read into the page but reverted back to be read in sql. Let me know if you need to know more about my situation. Thanks.
Bookmarks