Saturday, 15 June 2013

php - SEO Friendly URLs .htaccess -



php - SEO Friendly URLs .htaccess -

i'm working on .htaccess file creating seo friendly urls. still experimenting , works far. looking create bit more dynamic.

i want url structures similar below, don't know how many levels there be.

http://website.com/level_1/level_2/level_3/level_4/

in .htaccess file below manually coded observe 2 levels of url. there way can create check lastly level , work there create easier? in other words if url had 3 levels observe , rewriterule adjust how many levels there are.

rewriteengine on rewriterule ^([a-za-z0-9-/]+)/$([a-za-z0-9-/]+)/$ index.php?a=$1&b=$2 rewriterule ^([a-za-z0-9-/]+)/$([a-za-z0-9-/]+)$ index.php?a=$1&b=$2 rewriterule ^([a-za-z0-9-/]+)/$ index.php?a=$1 rewriterule ^([a-za-z0-9-/]+)$ index.php?a=$1

typically, you'd improve off doing rewriterule ^(.*)$ index.php?path=$1 , allowing index.php file handle logic.

php .htaccess

No comments:

Post a Comment