0

well i wanted ask how to get search 'keyword' or 'terms' using

  • Link : /s/hahahahaha
  • Search : hahahahaha
  • Script : <?php _e('Search results for', 'customtheme'); ?> "<?php echo $_GET['s'] ?>"

and its doesnt work here the result Search results for ""

Lawrence Cherone
  • 46,049
  • 7
  • 62
  • 106

1 Answers1

1

You should use something like apache mod_rewrite module so the /s/keyword will be rewritten internally to ?s=keyword and you'll get the value with $_GET['s'].

This is called fancy urls and I would never do this with php and do it with my http server (apache or nginx) instead.

Have a look at this example.

In your example you could create an .htaccess file (if you are using apache):

RewriteEngine On
RewriteBase /
RewriteRule ^s/(.*)$ yourphpfile.php?s=$1 [L,NC]

replacing yourphpfile.php with the filename of your php file.

jeprubio
  • 17,312
  • 5
  • 45
  • 56