简体   繁体   English

此网址的mod-rewrite规则

[英]mod-rewrite rule for this url

Can you help create a mod re write rule for this url please 您能帮忙为这个网址建立修改规则吗?

http://localhost/view.php?item_id=28&sef=2009-bristol-blenheim-in-west-yorkshire

i want it to go to 我希望它去

http://localhost/view.php?item_id=28

and i want my link to look like this 我希望我的链接看起来像这样

http://localhost/view/28/2009-bristol-blenheim-in-west-yorkshire

i am currently using this rule for another page 我目前正在将此规则用于其他页面

RewriteRule ^category/[!/.]*([A-Za-z]+)/?$ /browse.php?cat=$1    [NC,L]

but cant seem to update it to work for this one.. 但似乎无法对其进行更新以使其适用于此。

current htaccess 当前的htaccess

RewriteEngine On
Options +FollowSymLinks

# Browse Category
RewriteRule ^category/[!/.]*([A-Za-z]+)/?$ /browse.php?cat=$1    [NC,L]

# View Item
RewriteRule ^view/([0-9]+)/([a-zA-Z0-9-]+)$ /view.php?item_id=$1&sef=$2 [NC]

the browse category is working, View item is not 浏览类别有效,查看项目无效

If you want a request such as 如果您想要一个诸如

http://localhost/view/28/2009-bristol-blenheim-in-west-yorkshire

to silently become a server request for 悄悄地成为服务器的请求

http://localhost/view.php?item_id=28&sef=2009-bristol-blenheim-in-west-yorkshire

Then try this: 然后试试这个:

RewriteRule ^view/([0-9]+)/([a-zA-Z0-9-]+)$ /view.php?item_id=$1&sef=$2 [NC]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM