URL重写-PHP + Apache [英] URL Rewriting - PHP + Apache

查看:84
本文介绍了URL重写-PHP + Apache的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将PHP动态URL转换为静态URL. 例如,我想要类似

的URL

http://www.example.com/book.php?title=twilight 成为 http://www.example.com/book/twilight

http://www.example.com/writer.php?name= meyers 成为 http://www.example.com/writer/meyers

完成后,我在网站上的表单验证会更改吗?

我的URL重写需求可能不会太复杂.

我正在使用XAMPP,Apache和MySql在本地进行开发.稍后,我将其放置在网上.

我该怎么做? 这种URL重写技术最适合SEO吗?

解决方案

是的.您需要使用mod_rewrite.还搜索.ht_access文件.您可以将重写指令放在.ht_access文件中,并将它们放到服务器上您希望它们生效的任何目录中.

对于您希望使用此规则生成器的重写类型:

http://www.generateit.net/mod-rewrite/

是的,您要获取的URL是seo友好的.

I wanna turn PHP dynamic URLs into static URLs. For example, I want URLs like

http://www.example.com/book.php?title=twilight to become http://www.example.com/book/twilight

and http://www.example.com/writer.php?name=meyers to become http://www.example.com/writer/meyers

When it's done, will my form validation on the site change?

My URL rewriting needs might not be much too complicated.

I'm developing it locally using XAMPP, Apache and MySql. Later I'll put it online.

How do I do that? Is this kind of URL rewriting technique the most adviced for SEO?

解决方案

Yep. U need to use mod_rewrite. Also do a search for .ht_access files. You can put your rewrite directives in .ht_access files and drop them in to whatever directory on your server where you want them to take effect.

For the type of rewrite you want this rule generator should be of use to you:

http://www.generateit.net/mod-rewrite/

And yes the URL you're trying to achieve is seo friendly.

这篇关于URL重写-PHP + Apache的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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