重写.php扩展名 [英] rewrite .php extension

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

问题描述

请问我如何重写

有人可以重写此网址吗?

Could anybody please rewrite this url?

http://localhost/display_news_cat.php?news_cat_id = 14& p = 2

http://localhost/display_news_cat/14/2

谢谢

推荐答案

假设您已经安装了重写模块,则可以将其放在虚拟主机中:

Assuming you have installed the rewrite module, you could put this in your virtualhost:

RewriteEngine开启
RewriteRule/newsdev/news/newsdev/news.php [L]

RewriteEngine ON
RewriteRule /newsdev/news /newsdev/news.php [L]

请访问此站点以获取有关RewriteRule的更多信息: http://httpd.apache.org/docs/current/mod/mod_rewrite .html#rewriterule

Check this site for more information on RewriteRule: http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriterule

但是我怀疑这是最好的方法. rewritemodule通常不是执行此类简单操作的最有效方法.取决于您要重写的其他复杂事物.

But I doubt this is the best way. The rewritemodule is usually not the most efficient way to do easy things like these. Depends on what other complex things you want to rewrite.

这篇关于重写.php扩展名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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