如何使动态网页SEO的使用htaccess的友好的URL [英] How to make dynamic pages seo friendly url using htaccess

查看:171
本文介绍了如何使动态网页SEO的使用htaccess的友好的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的PHP页面我已经给定链路的HREF =test.php的?类别=XYZ。 在URL我希望这个页面链接,显示为测试/ XYZ。

In my php page i have given link as href="test.php?category="xyz". In url I want this page link to appear as "test/xyz".

在我的.htaccess文件我已经添加了

In my .htaccess file i have added

RewriteRule ^test/([a-zA-Z]+) test.php?category=$

但对我来说,这一点儿也不工作。

but this does'nt work for me.

所有test.php的其他环节被检测附加到他们的链接。 例如。如果有使用example.php它的出现为测试/使用example.php

All the other links in test.php gets test appended to their links. eg. if there was example.php its appears as test/example.php

帮助是AP preciated。 在此先感谢

Help is appreciated. Thanks in advance

推荐答案

这也许code可以帮助你

Maybe this code can help you

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^test/([a-zA-Z]+)$ test.php?category=$1
</IfModule>

试图访问这些网址:<?code> test.php的类别= ABC 和测试/ ABC 。如果两页显示相同的内容,此code成功。
要了解更多信息,请阅读<一个href="http://tutorial.world.edu/web-development/create-seo-friendly-urls-rewrite-htaccess-mod_rewrite/"相对=nofollow> 引用此处

Try to access these urls : test.php?category=abc and test/abc. If two pages show the same content this code successful.
To learn more, please read the reference here

这篇关于如何使动态网页SEO的使用htaccess的友好的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆