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. now i use like this form
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. i want to example.com/search/search+something
help me for that. thanks...
/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]
A quick and dirty javascript regex you could run is:
<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
..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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.