我为配置文件页面使用了htaccess友好URL,例如:
RewriteRule ^([^/]+)/?$ profile.php?id=$1 [L]如果我打开链接(例如/某些用户),它可以正常工作,并打开配置文件页面。
现在,在这个配置文件页面中,我有了搜索表单,我如何从链接中获得一个搜索值,因为当我提交时,我得到了这样的链接:/some-user?search=somekeywod
当提交时,我需要用搜索值打开该配置文件的url。
我的搜索表格很简单:
<div class="input-group md-form form-sm form-2 pl-0">
<input class="form-control my-0 py-1 lime-border" type="text" placeholder="Search..." name="search" aria-label="Search">
<div class="input-group-append">
<button type="submit" class="input-group-text lime lighten-2" id="basic-text1"><i class="fa fa-search text-grey"
aria-hidden="true"></i></button>
</div>
</form>```发布于 2020-11-25 16:21:30
在您的htaccess文件中尝试以下操作
RewriteEngine on
RewriteRule ^/profile/([0-9]+)/ /profile.php?id=$1 https://stackoverflow.com/questions/65008600
复制相似问题