Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/274.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在友好URL(htaccess)中带有额外参数的子目录中搜索页面_Php_Apache_.htaccess_Mod Rewrite_Search - Fatal编程技术网

Php 在友好URL(htaccess)中带有额外参数的子目录中搜索页面

Php 在友好URL(htaccess)中带有额外参数的子目录中搜索页面,php,apache,.htaccess,mod-rewrite,search,Php,Apache,.htaccess,Mod Rewrite,Search,我的访问权限当前为 # rewrite engine on and setting up base RewriteEngine On RewriteBase /leffa # replace + with _ RewriteRule ^(.+)\+(.+)$ $1-$2 [R=301] # external redirect from action URL to pretty one RewriteCond %{THE_REQUEST} /index(?:\.php)?\?q=([^\s&a

我的访问权限当前为

# rewrite engine on and setting up base
RewriteEngine On
RewriteBase /leffa

# replace + with _
RewriteRule ^(.+)\+(.+)$ $1-$2 [R=301]

# external redirect from action URL to pretty one
RewriteCond %{THE_REQUEST} /index(?:\.php)?\?q=([^\s&]+) [NC]
RewriteRule ^ %1? [R=302,L,NE]

# internal forward from pretty URL to actual URL
RewriteRule ^([^/.]+)/?$ index.php?q=$1 [L,QSA,NC]
当您单击任何电影标题时,将在中生成正确的重写。但是,当您从描述而不是标题中搜索时,我有一个额外的参数?kuvauksesta=1(我已经删除了复选框,因为它目前不起作用)

如何使用搜索查询中的第二个参数进行重写?手动输入确实有效,但使用复选框输入只会删除第二个参数,请尝试查看:

如何在url中设置第二个参数,使其干净且可搜索?

如下所示:

# rewrite engine on and setting up base
RewriteEngine On
RewriteBase /leffa/

# replace + with _
RewriteRule ^(.+?)\+(.+)$ $1-$2 [R=301,L,NE]

# external redirect from action URL to pretty one
RewriteCond %{THE_REQUEST} /index(?:\.php)?\?q=([^\s&]+)&(kuvauksesta)= [NC]
RewriteRule ^ %1/%2? [R=302,L,NE]

RewriteCond %{THE_REQUEST} /index(?:\.php)?\?q=([^\s&]+)\s [NC]
RewriteRule ^ %1? [R=302,L,NE]

# skip all files and directories from rewrite rules below
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]

# internal forward from pretty URL to actual URL (extra parameter)
RewriteRule ^([^/.]+)/([^/.]+)?$ index.php?q=$1&$2=1 [L,QSA]

# internal forward from pretty URL to actual URL
RewriteRule ^(.+)/?$ index.php?q=$1 [L,QSA]

http://www.rollemaa.org//leffa/index.php?q=pelottava&kuvauksesta=1
?例如,或任何使其工作的类似内容。只要没有额外参数(kuvauksesta)的正常搜索查询像现在一样工作,我注意到我还有另一个问题。如果电影标题中有斜杠,则找不到该页面。如何将斜杠转换成其他东西,比如dash(例如名为V/H/S的电影),仍然保留其余的规则?我不知道你的意思?以前,可以通过搜索找到电影,因此我需要将电影标题中的斜杠转换为标题中的下划线或破折号,但也要让搜索页面将其理解为斜杠。我想我也需要一些PHP吗?我已经有了这样的PHP:工作非常出色!再次感谢:)就行了。再次感谢你的回答!