I use the following PHP code to include files within my site. <?php $pid = @$_GET["pid"]; $exists = file_exists($pid. ".php") ? 1: 0; if($exists) @include($pid. ".php"); else{ if($pid){ @include("404.php"); } else @include("main.php"); } ?> my URL structure is like... domain.com/index.php?pid=foldername/pagename I want my URL structure to be like... domain.com/foldername/pagename I have done it before but due to the website being rolled back while i was away in Egypt the .htaccess file is now blank Any help appreciated.
I think the htaccess file should look something like: RewriteEngine On RewriteRule /(.*)/ index.php?pid=$1 [R] On a side note, never take filenames from query strings. It is a serious security hazard.