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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -