php - twitter like url and htaccess -
below .htaccess:
<ifmodule mod_rewrite.c> rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php?url=$1 rewriterule ^(.*)/$ index.php?url=$1 </ifmodule>
i trying fancy twitter url.
www.mywebsite.com/home rather www.mywebsite.com/home.php
in index.php code this:
<?php $key=$_get['url']; if($key=='index') { include('welcome.php'); // welcome page } else if($key=='login') { include('login.php'); // login page } else { include('index.php'); // go index.php } ?>
this keeps giving me invalid 404 error. , when output: echo $key
shows this: index.php
not index
what doing wrong?
that's worst way make url friendly because if have 1000 pages you'll have create "case" him in "switch". , if "require_once" passing parameter $key, vulnerability, known lfi (local file inclusion).
what recommend study or use rest micro-frameworks slim, respect/rest, aura router, , others.
look restful routes.
examples? slim documentation
Comments
Post a Comment