views:

31

answers:

1

I have a slight problem with .htaccess redirect.

I have a dynamic site with 2 levels of variables - content="type -(alpha)" and ID="number" but this is very not seo friendly what I really would like to create is a rewrite rule that generates a "friendly" url for serach engines & users alike. Very much like WordPress does.

Each ID is already unique (obviously) and on creation is creating a unique "permalink" field so for example ID=1 has a "permalink field" as "2009/10/27/page title" and ID=100 would be "2010/10/27 page title".

I would like folder/wall.php?content=type&ID=number to redirect to folder/permalink.php/html/htm (don't mind a non dynamic extension)

Any clues? - this is not right (I know) but it also "breaks" my css file

RewriteEngine On

RewriteRule wall/content/(.*)/ID/(.*)/ wall.php?content=$1&ID=$2
RewriteRule wall/content/(.*)/ID/(.*) wall.php?content=$1&ID=$2
A: 

You need to make sure you have a URL convention that won't conflict with other files on the server. For example, if your page is displaying "Products" and you don't have an actual folder in the root of your server called /products/, you could do this

RewriteEngine On
RewriteRule ^products/([^/\.]+)/([^/\.]+)/?$ wall.php?content=$1&id=$2 [L,NC,QSA]

Replace "products" in this example with whatever name is most appropriate for what your wall.php page does.

This would equate to the following URL

www.yoursite.com/products/title/29/

Which would rewrite to

www.yoursite.com/wall.php?content=title&id=29
Sohnee
OK I can access the page this way; but the style sheet does not work is it because it now thinks the style sheet is not there (in header) beceause it thinks a few directories away?
DURRRRRRR ...... thick today got it the directory structure changes ooops