tags:

views:

27

answers:

0

Hi all, I am running a site that uses the following URL format for the archives style page:

domain.com/view/
domain.com/view/page-2/

domain.com/view/by-name/
domain.com/view/by-name/page-2/

domain.com/view/by-price/
domain.com/view/by-price/page-2/

All these pages are powered by view.php so I have the following .htaccess file:

rewriteengine on

rewriterule ^view/?$ /view.php [L]
rewriterule ^view/page-([0-9]+)/?$ /view.php?page=$1 [L]
rewriterule ^view/by-(name|price)/?$ /view.php?sort=$1 [L]
rewriterule ^view/by-(name|price)/page-([0-9]+)/?$ /view.php?sort=$1&page=2 [L]

I'm curious if I could do what I am currently doing in 4 lines in only one.