[英]input text sumit to without question mark
example.com/search/?q=english+videos <- i want to like this after enter -> example.com/search/english+videos
i use for that .htaccess file also.. but now want to give url like this from form action. 我也使用该.htaccess文件。.但现在想从表单操作中提供这样的网址。 now i use like this form
现在我用这种形式
example.com/search/index.php example.com/search/index.php
<form name="menu_search" action="http://www.example.com/search/" method="get">
<input name="q" value="<?php if (!empty($_GET['q'])) { echo $_GET['q']; } ?>" id="videoSearch" />
</form>
this is my form action codes only. 这仅是我的表单操作代码。 someone search something its go to
example.com/search/?q=search+something
like that. 有人搜索某些内容,请转到
example.com/search/?q=search+something
类似的内容。 i want to example.com/search/search+something
我想
example.com/search/search+something
help me for that. 为此帮助我。 thanks...
谢谢...
/search/.htaccess /search/.htaccess
<Files .htaccess>
order allow,deny
</Files>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /search/
RewriteRule ^([^/]+)(?:/[^/]+)?/?$ load.php?q=$1 [L,QSA]
RewriteRule ^([^/]+)/[^/]+/([0-9]+)/?$ load.php?q=$1&p=$2 [L,QSA]
RewriteRule ^search/(.*)$ load.php?q=$1 [L]
not work last rule how to fix it... RewriteRule ^search/(.*)$ load.php?q=$1 [L]
最后一条规则不起作用如何解决...
RewriteRule ^search/(.*)$ load.php?q=$1 [L]
A quick and dirty javascript regex you could run is: 您可以运行的一种快速而肮脏的javascript正则表达式是:
<script>
function removeQuestionMark()
{
var initialString = "example.com/search/?q=english+videos";
initialString = initialString.replace(/\?/g, '');
console.log(initialString) //This just outputs to new string.
}
</script>
Outputs: example.com/search/q=english+videos 输出:example.com/search/q=english+videos
..Although that regex would replace all '?'. ..尽管该正则表达式将替换所有的“?”。 A more complex regex would be required to ensure you didn't accident remove one you may want.
需要使用更复杂的正则表达式,以确保您不会意外删除可能需要的正则表达式。 It may work for what you want to do.
它可能适合您想要的工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.