Link to home
Start Free TrialLog in
Avatar of JiveMedia
JiveMediaFlag for Australia

asked on

htaccess url masking and php page

Hi,

Im new to htaccess and masking urls and would like a bit of help.
I have a index.php file that acts as a shell for the other pages on my website.
Inside the main content div in that page, i have made an array with the below php code so if i type in for example, "www.domain.com.au/index.php?ref=contact" that would take me to the contact page.

Now, i want it so if i type in "www.domain.com.au/contact" it would take me to the index page with the added contact page into the main div of index.php.

Could someone please help :) thanks.
<?php
$pagelist = array("home", "services", "contact");
if(in_array($_GET['ref'], $pagelist)) {
include($_GET['ref'].".php");
}
?>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of David S.
David S.
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JiveMedia

ASKER

Thanks kravimir,

Got it working, however i had to change the 2 RewriteCond's to;

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f

so it would load my css and images files.