R
R
redd_i2016-12-28 01:42:08
htaccess
redd_i, 2016-12-28 01:42:08

How to do 2-level Rewrite?

Hi all. I have a category.php file and it displays categories like category.php?id=Fashion
I made a modrewright link like this: /category/Fashion

RewriteRule ^category/([^\.]*)$ category.php?id=$1 [L,QSA]

In the same directory, I want to make a photo display
category.php?id=Fashion&album=Allfffffff
Please tell me how to make a beautiful link like /category/Fashion/Allfffffff/ ?
Thank you in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
Zlatoslav Desyatnikov, 2016-12-28
@redd_i

I'm not a .htaccess master, but this is how it works.
You can test here: htaccess.mwl.be

RewriteRule ^category/([^/]+)/([^/]+)/?$ category.php?id=$1&album=$2 [L,QSA]
RewriteRule ^category/([^/]+)/?$ category.php?id=$1 [L,QSA]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question