0

I have a page called category.php and inside of it I have links to articles and others categories.

To open an article that is inside of a category, the code is:

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

To open other category that is inside of category, the code is:

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

I have this 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 just fine, but when I click in a link inside of category page to open an article or other category, the link turns:

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

Both URLs results on page not found, what is best to do to have it organized?

Something like:

http://www.example.com/category/1/article/1
Andre Oliveira
  • 197
  • 2
  • 10

1 Answers1

0

You can also add a relative URI base to the header of your pages:

<base href="/" />
Jon Lin
  • 142,182
  • 29
  • 220
  • 220