Tuesday, 3 September 2013

twitter like url and htaccess

twitter like url and htaccess

Below is my .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 am trying to do the fancy twitter url.
www.mywebsite.com/home rather than www.mywebsite.com/home.php
in my index.php code its like 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 back to index.php
}
?>
this keeps giving me a an invalid 404 error. and when I output: echo $key
it shows like this: index.php not index
what am i doing wrong?

No comments:

Post a Comment