.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