简体   繁体   English

使用htaccess更改网址

[英]change the url using with htaccess

i am trying to change the url using htaccess rewrite i want to change this url 我正在尝试使用htaccess重写来更改URL我想更改此URL

page/details.php?name=abcdef&id=18

to

page/abcdef

Here my sample code for this 这是我的示例代码

RewriteEngine On
RewriteRule ^company/([A-Za-z0-9-]+)/$1 company/details.php?name=$1&id=$2 [R=301,L]

this is not working, and also i was tried many code but not working,please help me to find htaccess code for this url Thanks advance 这是行不通的,并且我也尝试了很多代码,但是没有用,请帮助我找到此网址的htaccess代码。

This should do what you're after: 这应该执行的操作:

RewriteCond %{QUERY_STRING} ^.*name=([a-zA-Z0-9]*).*$
RewriteRule ^page/(.*)$ page/%1? [R=301,L]

Try this one: 试试这个:

RewriteEngine on
RewriteCond %{QUERY_STRING} ^name=(.*)&id=(.*)$
RewriteRule ^page/(.*)$ /page/%1? [R=301,L]

This will check for these 2 parameters in the query string. 这将检查查询字符串中的这两个参数。

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

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