简体   繁体   English

我如何从.htaccess重写此字符串

[英]How can i rewrite this string from .htaccess

I've searched for this question but I only come across really specific answers that seem difficult to tailor to my specific needs. 我已经搜索了这个问题,但是我只遇到了真正难以回答的特定答案,这些答案似乎很难满足我的特定需求。

How can I rewrite the URL's? 如何重写URL?

Now I have the URL like this: automv.ro/anunturi-auto/?make=bmw and I want to make it look like this automv.ro/anunturi-auto/bmw 现在我有了这样的URL: automv.ro/anunturi-auto/?make=bmw ,我想使其看起来像这样automv.ro/anunturi-auto/bmw

I have tried with this but doesn't work: 我已经尝试过了,但是没有用:

RewriteRule ^anunturi-auto/?make= anunturi-auto/$1 [L] 
RewriteCond %{QUERY_STRING} .
RewriteRule (.*) $1?

Try the following: 请尝试以下操作:

RewriteEngine On

RewriteCond %{THE_REQUEST} /(anunturi-auto)/\?make=(bmw) [NC]
RewriteRule ^anunturi-auto/?$ /%1/%2? [R=301,L]

RewriteRule ^(anunturi-auto)/([^/]+)/?$ /$1?make=$2 [L]

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

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