0

I have problem when using htaccess rewriteurl, it was stacking every I change the page,

I try this one :

Options +FollowSymlinks

RewriteEngine On
RewriteRule ^category/([^/]*)/([^/]*)$ /test/category.php?k=$1&page=$2 [L]

change this

http://localhost/test/category.php?k=fashion&page=2

become like this

http://localhost/test/category/fashion/2

the problem occure when i'm going to page 3

URL become like this

http://localhost/test/category/fashion/category/fashion/3

so on...

switch page to page 4

http://localhost/test/category/fashion/category/fashion/category/fashion/3

why is this looping?

what's wrong with my code??

Ching Ching
  • 217
  • 1
  • 5
  • 15

1 Answers1

0

Because you've changed your URL's to look like http://localhost/test/category/fashion/2, any relative links on that page will think the new URL base is: http://localhost/test/category/fashion/ instead of http://localhost/test/, which would be the base if the browser loaded http://localhost/test/category.php?k=fashion&page=2. Because of this, you either need to make all your links absolute URLs or add the base in you html header:

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