wesside
wesside

Reputation: 5740

Conditional .htaccess for URL

RewriteRule ^photographs/?$ photographs.php [L]
RewriteRule ^photographs/(.*)/?$ photographs.php?cat=$1 [L,QSA]
RewriteRule ^photographs/(.*)/(.*)/?$  photographs.php?cat=$1&page=$2 [L,QSA]

I need this to have options such as

Thanks

Upvotes: 0

Views: 100

Answers (1)

Nitram Saneco
Nitram Saneco

Reputation: 301

RewriteRule ^photographs/?$ index.php [L]
RewriteRule ^photographs/([^/]+)/?$ index.php?cat=$1 [L,QSA]
RewriteRule ^photographs/([^/]+)/([^/]+)/?$  index.php?cat=$1&page=$2 [L,QSA]

That's because (.*) also matches / character.

Upvotes: 1

Related Questions