mod rewrite - .htaccess rules to separate page types -
i'm having problems rewriting urls following rules
rewriteengine on rewriterule ^page/(.*)$ index.php?pag=cms&title=$1 [nc] rewriterule ^admin/(.*)$ admin/$1 [nc] rewriterule ^(.*)$ index.php?pag=$1 [nc,l]
what i'm trying achieve check if url cms page or not , leave admin urls are. if remove last condition works have no rule not cms pages.
ideally want have 1 rule every page (cms or not) can't figure out how check other using page/
in url.
mod_rewrite keep looping through rules until uri stops changing (or reaches internal redirect limit, resuling in 500 error). need add few conditions last rule won't rewrite uri's that's been routed:
rewriterule ^page/(.*)$ index.php?pag=cms&title=$1 [nc] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php?pag=$1 [nc,l]
additionally, second rule nothing except passthrough, can replace with
rewriterule ^admin/(.*)$ - [nc,l]
Comments
Post a Comment