i'm new .htaccess , learning advanced techniques in php. working on php site in attempt challenge skills , trying implement .htaccess rewrite url seo friendliness. difficulty i'm having when user clicks on language hyperlink, availaible albums' details of particular language should displayed, i'm using method post user selection same page (album). can possibly have separate pages each language if best so. way i'm hosting site justhost.
normal method:
www.site.co.uk/albums - **page** <li > <a href="albums.php?selection=tamil/"> tamil </a> </li> - **hyperlink** <li> <a href="/albums.php?selection=tamil&cat=featured" >featured </a></li> result: tamil album contents displayed ...... works fine...
what seo,
www.site.co.uk/albums.php?selection=language **url rewritten** www.site.co.uk/albums/tamil/ ->>> **expected result** <li > <a href="albums/tamil/"> tamil </a> </li> - html code in album page i use '/' in url separation,if possible. i'm getting 404 error when click on 'tamil' hyperlink. (custom error page).
please take @ current .htaccess i'm using.
#use php5.4 default addhandler application/x-httpd-php54 .php rewritebase / # prevent directoy listing options -indexes rewriteengine on # security reasons, option followsymlinks cannot overridden. #options +followsymlinks options +symlinksifownermatch rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^([^\.]+)$ $1.php [nc,l] # specify search friendly urls rewriterule ^albums/(.*)/$ albums.php?selection=$1 errordocument 400 /error.php?code=400 errordocument 401 /error.php?code=401 errordocument 403 /error.php?code=403 errordocument 404 /error.php?code=404 errordocument 500 /error.php?code=500 i appreciate, yours suggestions, advices , comments , hope made myself clear on i'm intending do. many all..
you need re-arrange rules. rule right above albums 1 applied first. try:
#use php5.4 default addhandler application/x-httpd-php54 .php rewritebase / # prevent directoy listing options -indexes rewriteengine on # security reasons, option followsymlinks cannot overridden. #options +followsymlinks options +symlinksifownermatch # specify search friendly urls rewriterule ^albums/(.+)/$ albums.php?selection=$1 [l,qsa] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^([^\.]+)$ $1.php [nc,l] errordocument 400 /error.php?code=400 errordocument 401 /error.php?code=401 errordocument 403 /error.php?code=403 errordocument 404 /error.php?code=404 errordocument 500 /error.php?code=500
Comments
Post a Comment