2013-04-02 136 views

回答

0

你对PHP没有很大的工作,只要确保你会创建干净的URL,那么删除特殊字符和德语元音变音(如果有的话)。

只需在您的php脚本中将您的链接从http://www.mysite.com/company.php?company_id=74&name=DesignSourceLtd改为http://www.mysite.com/company/74/DesignSourceLtd即可。现在

,在你的.htaccess文件,做这样的事情:

RewriteEngine On 

Options FollowSymLinks 

RewriteRule ^([-_a-zA-Z0-9]*)/([-_a-zA-Z0-9]*)/([-_a-zA-Z0-9]*)$ index.php?page=$1&id=$2&name=$3 

这将导致你: index.php页面=公司& ID = 74 &名= DesignSourceLtd

+0

感谢名单。使用你的代码,如果我在浏览器上放置http://www.mysite.com/company/74/DesignSourceLtd,它会自动转到正确的页面 – user1180807

+0

是的,应该是。这使用全局index.php页面进一步重定向。但是你也可以把它改成'RewriteRule ^([-_a-zA-Z0-9] *)/([-_a-zA-Z0-9] *)/([-_a-zA-Z0-9] * )$ $ 1.php?id = $ 2&name = $ 3' 打开第一个参数给出的页面,即company.php?id = ...&name = ... – elasticman

相关问题