Problème with Human-friendly URLs

5 years ago

fan2misa
Member | 6
+
0
-

Hi everybody.
I have a problem with my URLs. I would URL like this :

http://localhost/mywebsite/www/blog/page/1
http://localhost/mywebsite/www/blog/page/2
http://localhost/mywebsite/www/blog/page/2

But I have this URLs :

http://localhost/mywebsite/www/blog?page=1
http://localhost/mywebsite/www/blog?page=2
http://localhost/mywebsite/www/blog?page=3

And in my router, I have this :

$router[] = new Route('blog', 'Frontend:Blog:index');
$router[] = new Route('blog/page/<page \d+>', 'Frontend:Blog:index');

Can you help me for it please ?

5 years ago

Majkl578
Moderator | 1379
+
0
-

That should work, try swapping those routes so the one with “page” is before the first more generic one.

5 years ago

fan2misa
Member | 6
+
0
-

great. thanx for it ^^. you save me.

5 years ago

Majkl578
Moderator | 1379
+
0
-

There is simple rule to follow when writing rules – most specific at top, most generic at bottom.