开发者

Conditional .htaccess for URL

开发者 https://www.devze.com 2023-01-21 07:43 出处:网络
RewriteRu开发者_运维技巧le ^photographs/?$ photographs.php [L] RewriteRule ^photographs/(.*)/?$ photographs.php?cat=$1 [L,QSA]
RewriteRu开发者_运维技巧le ^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

  • /photographs
  • /photographs/category
  • /photographs/category/3

Thanks


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消