0
我想表明我的网页网址:如何友好的URL转换的搜索引擎优化PHP页面
www.mypage.com/?q=picture
相反的:
www.mypage.com/picture.html
我不知道如何将网页重定向我想看看。但是URL不能显示网页扩展 我已经试过这样的事情,但它不工作:
<a href="?q=home" style="text-decoration: none; color: #1E90FF; font-size:25px;">Home</a>
<?php
if(isset($_GET['q']) && $_GET['q']!="")
{
$ext=".php";
$page=$_GET['q'].$ext;
if(file_exists($page))
{
header('location:$page');
}
else
{
header('location:errorpage.php');
}
}
?>
您的代码无关用'.htaccess'我想你要找的'mod_rewrite的'http://httpd.apache.org/docs/current/mod/mod_rewrite.html – sharf 2014-10-26 21:46:26
我不寻找任何mod_rewrite ..我只想使用我的代码,但是当我尝试我的代码,它不是重定向页面我想要。就是这样 – 2014-10-27 03:34:22
尝试更改$ ext为“.html” – sharf 2014-10-27 23:22:21