[英]URL rewrite with .htaccess (remove $_GET variables)
I have this URL : https://example.com/beehive_deposit?id=6a23361b37MjE-&owner_cus_id=607dde5711MQ--
我有这个网址:
https://example.com/beehive_deposit?id=6a23361b37MjE-&owner_cus_id=607dde5711MQ--
: https://example.com/beehive_deposit?id=6a23361b37MjE-&owner_cus_id=607dde5711MQ--
And I want to convert it in this: 我想将其转换为此:
https://example.com/beehive_deposit/6a23361b37MjE-/607dde5711MQ--
I am using codeigniter framework in PHP.
我在PHP中使用codeigniter框架。
I tried something like this in .htaccess
: 我在
.htaccess
尝试过这样的事情:
RewriteEngine on
RewriteBase /
RewriteRule ^beehive_deposit/([^/.]+)/?$ beehive_deposit?id=$1 [L,QSA,NC]
HTML: HTML:
<a href="/beehive_deposit?id=b5347cb1cdMjE-&owner_cus_id=d6cc12707fMQ--"></a>
You're going about it wrong. 您正在做错事情。 The URLs you output to client-side HTML should already be in the "clean" format:
您输出到客户端HTML的URL应该已经是“干净的”格式:
<a href="https://example.com/beehive_deposit/6a23361b37MjE-/607dde5711MQ--"></a>
And then your rewrite rule becomes (basically): 然后,您的重写规则(基本上)变为:
RewriteRule ^beehive_deposit/(.*)/(.*)$ beehive_deposit.php?id=$1&cus_id=$2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.