I've been searching all over the web and haven't yet found any solution to this issue. I'm hoping you could shed some light on the situation.
I have my index file set up like this:
<header></header>
<div id="main">
<?php
if(isset($_GET["p"])) $p = $_GET["p"];
else $p = "home";
if(file_exists("pages/{$p}.php")) include("pages/{$p}.php");
?>
</div>
which makes me load my pages with a ?p=contact
href.
Say I would like to display a users profile. I'd then create a subfolder in my "pages" folder, making the relative path pages/users/profile.php
, thus the href ?p=users/profile&uid=5
. But that leaves an ugly URL (as well as SEO rating).
How would I rewrite that URL to look like /users/profile/5
?
EDIT: I've tried the following, resulting in HTTP 500:
RewriteRule ^([^/]*)/([^/]*)$ /?p=$1&uid=$2 [L]
EDIT: My .htaccess file, located directly inside root folder: http://pastie.org/2268239
Line 338 is where I want to achieve this (currently just a comment).