[英]rewrite url with parameters in .htaccess
I have this incoming url where the last part is dynamic.我有这个传入的 url 最后一部分是动态的。
https://www.rishi.com/q/CuYuGy
and want to rewrite the url to below link.并想将 url 重写到以下链接。
https://rishi.com/test.php
where it gets the dynamic part and performs action它在哪里获取动态部分并执行操作
so far i have done this到目前为止,我已经做到了
RewriteCond %{HTTP_HOST} ^rishi.com/q/%{QUERY_STRING}$
RewriteRule ^$ {HTTP_HOST} ^rishi.com/test.php [L,R=301]
please help me resolve it.请帮我解决它。 Thanks
谢谢
Try this尝试这个
RewriteRule ^q/([a-zA-Z0-9-/]+)$ test.php?query_string=$1
RewriteRule ^q/([a-zA-Z0-9-/]+)/$ test.php?query_string=$1
Try this below htaccess code.在 htaccess 代码下面试试这个。 It should help you
它应该可以帮助你
RewriteCond %{REQUEST_URI} ^/q/(.*)$
RewriteRule ^(.*)$ /test.php [L,R=301]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.