【问题标题】:Htaccess / PHP - Clean URLs from ? to / (folders)Htaccess / PHP - 从?到/(文件夹)
【发布时间】:2019-01-10 00:41:37
【问题描述】:

我正在尝试清除我的网址:

https://cocrele.com/service-areas/?state=kentucky&city=asher

到这里:

https://cocrele.com/service-areas/kentucky/asher/

RewriteEngine On
RewriteRule ^/?service-areas/([^/]+)/([^/]+)/(.+)$ /index.php?eid=$1&cat=$2 [L,QSA]

我将如何解决这个问题以及我的代码需要如何在页面中?我目前有这个:

echo '<a class="gCity" href="https://cocrele.com/service-areas/?state='.$lowercase_n_state.'&city='.$string_city2.'">'.$array['geoplugin_place'].', '. $array['geoplugin_region'].'</a>';

【问题讨论】:

标签: php html .htaccess


【解决方案1】:

问号的作用是将变量传递给您的视图。这是从用户那里获取信息的好方法。你可以阅读它herehere

如果您想删除“?”从 url,您将需要告诉 php 在哪里可以找到变量。您的问题可能与this question 重复,所以我会在那里检查答案。

【讨论】:

    猜你喜欢
    • 2014-07-12
    • 1970-01-01
    • 2014-06-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-09
    • 1970-01-01
    • 2011-06-01
    相关资源
    最近更新 更多