.htaccess中删除URL的一部分 [英] Htaccess Remove part of URL

查看:409
本文介绍了.htaccess中删除URL的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的URL: http://www.website.nl /pagina/4/wie-ben-ik.html

pagina是一个真实的PHP文件。 4是网页的id,用id我从数据库中获取的结果。

"pagina" is a real php document. "4" is the id of the webpage, with the id I get the results from the database.

我可以改变这个网址 http://www.website.nl/wie-ben- IK 中与htaccess的?

Can I change this URL to http://www.website.nl/wie-ben-ik with htaccess?

感谢您!

推荐答案

您必须通过ID某种方式或其他,如果你想让它从数据库中查询。

You have to pass the id some way or the other if you want it to query from the database.

要么使用一个查询字符串(名称 - 值对),或者有它的URI喜欢你正在做的上面。

Either use a query string (name-value pair) or have it in the URI like your are doing above.

如果您不希望 pagina 在你的URI,你可以有你的URI是这样的: http://www.website.nl/wie-ben-ik/<the要发送&GT号;

If you do not want pagina in your URI you can have your URI's like this: http://www.website.nl/wie-ben-ik/<the number you want to send>

RewriteCond %{REQUEST_URI} ^/(wie-ben-ik)/(\d+)
RewriteRule ^ /pagina/%2/%1\.html

这篇关于.htaccess中删除URL的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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