Tuesday 15 February 2011

php - mod_rewrite with subdirectory -



php - mod_rewrite with subdirectory -

i have page called category.php , within of have links articles , others categories.

to open article within of category, code is:

<a href='article/". $art_id ."'> article 1 </a>

to open other category within of category, code is:

<a href='category/". $cat_id ."'> category 2 </a>

i have code on .htaccess:

rewriteengine on rewriterule ^category/([a-z0-9]+)$ category.php?id=$1 rewriterule ^article/([a-z0-9]+)$ article.php?id=$1

category 1 open fine, when click in link within of category page open article or other category, link turns:

http://www.example.com/category/article/1 http://www.example.com/category/category/2

both urls results on page not found, best have organized?

something like:

http://www.example.com/category/1/article/1

you can add together relative uri base of operations header of pages:

<base href="/" />

php apache .htaccess mod-rewrite

No comments:

Post a Comment