Hello,
I want to make a simple website, and friendly urls would be a great step towards that. I have been trying this for 2 days without success.
www.mydomain.com/join redirects to www.mydomain.com/index.php?path1=join
www.mydomain.com/forum redirects to www.mydomain.com/index.php?path1=forum
www.mydomain.com/forum/getting-started redirects to www.mydomain.com/index.php?path1=forum&path2=getting-started
These directories do not actually exist. They are going to look like they do.
You should understand what I'm trying to achieve now.
index.php
<?php
global $path1;
global $path2;
$path1="";
$path2="";
if (isset($_GET['path1']))
{
$path1=$_GET['path1'];
}
if (isset($_GET['path2']))
{
$path2=$_GET['path2'];
}
//code omitted. Standard XHTML header
if (isset($path1))
{
switch ($path1)
{
case "join":
include("join.php");
break;
case "forum":
include("forum-index.php");
break;
default:
include("404.php");
}
}
else
{
include("start_page.php");
}
And my htaccess:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^([^/]+)/?$ /index.php?path1=$1 [QSA,L]
RewriteRule ^forum/([^/]+)/?$ /index.php?path1=forum&path2=$1 [QSA,L]