如何管理与分页上的.htaccess缩短搜索结果

编程入门 行业动态 更新时间:2024-10-25 00:37:04
本文介绍了如何管理与分页上的.htaccess缩短搜索结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

下面哪个是对PHP语言开发的应用程序。

Here on the application which is developed on php language.

问题上分页,有三个变量(PAGE,refone,reftow)

the problem is on pagination, there is three variables(PAGE, refone ,reftow)

不是形式将是这样的:

<from> <input type=text name=refone> <input type=text name=reftow> <input type=submit value=search name=search> </from>

在用户提交搜索会导致,

as the user submit search it will result,

例如 - > refone = 1和reftow =任何

for example the -> refone = 1 and reftow = any

in the actual url = ?page=1&refone=1&reftow=% ... this works with .htaccess url = ?page/1/1/% ... not works

现在因为有搜索(refone&LT; - > reftow)拖选项(refone - >任意)(任意&LT; - reftow)基本上它与正常的URL的工作,但是当我使用的.htaccess为使其短不要让用户知道确切的URL的工作,所以我用波纹管的.htaccess更好的固定和URL管理就像缩短。

now as there is tow option for search (refone <-> reftow) (refone -> any) (any <- reftow) basically it's working with normal url, but when I use .htaccess for making it short and do not let user to know the exact url job so I use bellow .htaccess for better securing and url management like shortening.

RewriteEngine on RewriteCond %{SCRIPT_FILENAME} -d RewriteCond %{SCRIPT_FILENAME} -f RewriteRule . - [L] RewriteRule ^sref/([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+) sref.php?page=$1&refone=$2&reftow=$3 [L,NC] RewriteRule ^sref/([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+) sref.php?page=$1&refone=$2 [L,NC] RewriteRule ^sref/([-a-zA-Z0-9]+)/?$ sref.php?page=$1 [L,NC]

现在的情况:

m.lhost/web/sref.php?page=1&refone=1&reftow=% m.lhost/web/sref.php?page=1&refone=%&reftow=1 m.lhost/web/sref.php?page=1&refone=%&reftow=%

它的工作原理,甚至当我使用分页像2,3页...它会工作,但使用.htacess后

it works and even when I use pagination like page 2,3... it will work but after using the .htacess

m.host/web/sref/1/1/% m.host/web/sref/1/%/1 m.host/web/sref/1/%/%

在这里不能罚款的网址。 注:这里经过搜索,它会根据搜索的结果,这与在这里进行的.htaccess工作正常,但如果我使用.htacess有问题

here it can not fine the url. Note: here after search, it will use pagination based on search result, which here with out .htaccess working fine but if I use .htacess having problem.

在此先感谢任何样的建议。

thanks in advance for any kind of advice.

推荐答案

您必须添加%来允许的字符列表,也是你的重写规则应该从网​​络/ SREF /...

You must add that % to the list of allowed characters, also your RewriteRule should start with web/sref/...

RewriteEngine on RewriteCond %{SCRIPT_FILENAME} -d RewriteCond %{SCRIPT_FILENAME} -f RewriteRule . - [L] RewriteRule ^web/sref/([A-Za-z0-9_-]+)/([\%A-Za-z0-9_-]+)/([\%A-Za-z0-9_-]+) sref.php?page=$1&refone=$2&reftow=$3 [L,NC] RewriteRule ^web/sref/([A-Za-z0-9_-]+)/([\%A-Za-z0-9_-]+) sref.php?page=$1&refone=$2 [L,NC] RewriteRule ^web/sref/([-a-zA-Z0-9]+)/?$ sref.php?page=$1 [L,NC]

更多推荐

如何管理与分页上的.htaccess缩短搜索结果

本文发布于:2023-11-02 08:28:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1551895.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:分页   搜索结果   htaccess

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!