Thursday, 8 August 2013

public url different to behind the scenes url

public url different to behind the scenes url

How do I allow a user to navigate to this url
example.com/aaron-cole-about, and behind the scenes it changes it to this
url to example.com/about?id=52, but still shows this url on the browser
example.com/aaron-cole-about
tried this on my .htaccess file, but i didn't seem to work:
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.php [L,QSA]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^/aaron-cole-about$ /about?id=52 [L]
What is wrong with my .htaccess?
new .htaccess:
Options -MultiViews
RewriteEngine On
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^/aaron-cole-about$ /about?id=52 [L]
Options -MultiViews
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.php [L,QSA]
Nearly done, but lost the id=52 value on the aaron-cole-about page, which
is needed to show some information on the page, like the echo's from
database
<?php session_start();
error_reporting(E_ALL ^ E_NOTICE);
include("db_conn.php");
$qry_string = "select * from stars INNER JOIN roles ON roles.starID =
stars.starID where stars.starID = ?";
$prep = $pdo_conn->prepare($qry_string);
$prep->execute(array($_GET['id']));
$result = $prep->fetch(PDO::FETCH_ASSOC);
$pieces = explode(" ", $result['starName']);
$gender = "him";
?>
<center><b><p style="font-size:30pt; color:black"><a href="<?php echo
"{$result['starURL']}" ?>" style="color:black; text-decoration:
none"><?php echo "{$result['starName']}" ?></a></p></b></center>
<center><TABLE style="WIDTH: 1000px; HEIGHT: 5px" border="1"
borderColor="#B6AFA9" bgColor="#FFFFFF" align="center">
<TBODY><TR> <TD width=100
onMouseOver="this.bgColor='grey'"
onMouseOut="this.bgColor='#FFFFFF'"><P align=center><FONT
face=Arial><STRONG><A href="<?php echo "{$result['starURL']}"
?>-about" style="color:black; text-decoration:none">About
<?php echo "$pieces[0]" ?></A></STRONG></FONT></P></TD>
<TD width=100 onMouseOver="this.bgColor='grey'"
onMouseOut="this.bgColor='#FFFFFF'"><P
align=center><FONT face=Arial><STRONG><A href="<?php
echo "{$result['starURL']}" ?>" style="color:black;
text-decoration:none">Ask a
Question</A></STRONG></FONT></P></TD>
<TD width=100 onMouseOver="this.bgColor='grey'"
onMouseOut="this.bgColor='#FFFFFF'"><P
align=center><FONT face=Arial><STRONG><A href="<?php
echo "{$result['starURL']}"?>-interviews"
style="color:black; text-decoration:none">STARSQA
INTERVIEWS</A></STRONG></FONT></P></TD>
<TD width=100 onMouseOver="this.bgColor='grey'"
onMouseOut="this.bgColor='#FFFFFF'"><P
align=center><FONT face=Arial><STRONG><A href="<?php
echo "{$result['starURL']}" ?>-contact"
style="color:black; text-decoration:none">Contact
<?php echo "$pieces[0]"
?></A></STRONG></FONT></P></TD></TR></TBODY></TABLE><!--end
of header div-->
</center>

No comments:

Post a Comment