php help
- Started
- Last post
- 10 Responses
- trooperbill
i want to use the new canonical rel tag to solve a sites duplicate content issues however im not that familiar with PHP.
what i need to do is display the current pages url without the querystring
anyone know how to do this? it needs to populate the following tag
<link rel="canonical" href="http://www.website.com/page.php">
where the url is page.php?id=kjhjkhasdfkjhsfdkjsh... etc
- TResudek0
http://www.webcheatsheet.com/PHP…
This shows you precisely how to do that.
- mikotondria30
I was on that page the other day with a different problem, and it didn't solve it..
I need to know if the page has any $_GET variables or not, or whether the user has landed at index.php "cold"..
At the moment, Ive tried to run through every get variable I can think of for my logic, but if anyone knows of a simple way to check that would be awesome. isset($_REQUEST) doesnt cut it.. : /
- neverblink0
you mean:
if($_GET)
- BattleAxe0
use post
- keiTai0
$_SERVER['QUERY_STRING'], i
- moth0
$_SERVER['QUERY_STRING']
or
$_GETExplode either.
But I think, what trooper is after, is URL rewriting isn't it?
PHP can't change your URL's for you. You need Apache to do that for you...
- moth0
But then the best you can expect troopr is
http://www.website.com/page.php?…
to
http://www.website.com/page/kjhj…If you remove the id altogether, I suspect your app will break!
- acescence0
$path = split('\?',$_SERVER['REQUEST_URI...
echo $path[0];
- trooperbill0
<link rel="canonical" href="http://www.website.com<?php echo parse_url($_SERVER['REQUEST_URI'],PHP_URL_PATH);?>">