Multiple rewriterules

Discuss practical ways rearrange URLs using mod_rewrite.

Multiple rewriterules

Postby u70mo » Wed Sep 23, 2009 10:26 pm

First of all, sorry if my english not so good

I have some rewrite rules like this

Code: Select all
RewriteEngine On
Options +FollowSymLinks
RewriteRule ^([a-zA-Z0-9]+)/?$ ?hal=$1 [QSA,L]
RewriteRule ^([a-zA-Z0-9]+)/([0-9]+)/?$ ?hal=$1&id=$2 [QSA,L]
RewriteRule ^([a-zA-Z0-9]+)/([0-9]+)/detail/([0-9]+)/?$ ?hal=$1&id=$2&detail=$3 [QSA,L]

i have a problem went i click my link
i have 2 link here
1. http://localhost/collection/news
2. http://localhost/collection/news/2

if i click a link number 1 the url will be normal
--> http://localhost/collection/news
and if i click a link number 2 the url will still normal
--> http://localhost/collection/news/2
but when i click again link number 1, then my link have some problem like this
--> http://localhost/collection/news/news/2

Is there anyone can help me.

Posts: 2
Joined: Tue Sep 22, 2009 9:59 am

Postby richardk » Fri Sep 25, 2009 12:03 pm

Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby u70mo » Fri Sep 25, 2009 11:56 pm

Thanks richard, it works.

I used option number 4.
Posts: 2
Joined: Tue Sep 22, 2009 9:59 am

Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 3 guests