php : SEO 友好的 url [英] php : SEO friendly urls

查看:44
本文介绍了php : SEO 友好的 url的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个新项目,我想为此网站创建 SEO 友好的 URL,例如

I am working on a new project, I want to create SEO friendly URL's for this site like

mysite.com/first_content、mysite.com/second_content.URL 必须是动态的,这意味着 URL 必须与内容标题相关.我怎么能做到这一点?可以使用htacess吗?

mysite.com/first_content, mysite.com/second_content. URL's must be dynamic which means URL's must related to the content title. How can I done this ? Is is possible to use htacess, ?

谢谢

推荐答案

.htaccess 的示例规则(确保启用 mod_rewrite 后):

Sample rules for .htaccess (once you make sure mod_rewrite is enabled):

  RewriteEngine On
  RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule (.*) index.php?page=$1 [L]

这些规则匹配任何不是现有文件的 URL 并将其传递给您的脚本.

These rules match any URL that isn't an already existing file and passes it to your script.

这篇关于php : SEO 友好的 url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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