English 中文(简体)
用 mo改的_改成美元
原标题:using mod_rewrite with $_GET

我试图弄清问题。 i) 类似于:

 <form action="index.php?<?=$_GET[ search-input01 ]?> " method="get">
   <p class="nom t-center">
     <label for="search-input01">All:</label>
     <input type="text" size="75" name="q" id="search-input01" />
     <input type="image" src="design/search-button.gif" class="search-submit" />
   </p>
 </form>

当u做搜索时/index.php?q=SEARCHTERMHERE&x=0&y=0。 我愿作此发言:/search-SEARCHTERMHERE

如何做?

最佳回答

类似情况:

if (isset($_GET[ q ])) {
    header( Location: http://example.com/search- .rawurlencode($_GET[ q ]));
    exit;
}

这将转而提出“URL query”包含q的请求。 如同以下各条论点:/index.php?q=SEARCHTERMHERE&x=0&y=0/search-SEARCHTERMHERE


<><>Edit>/strong> 你们也可以用 mo子来尝试:

RewriteCond %{THE_REQUEST} ^GET /index.php?
RewriteCond %{QUERY_STRING} ^(([^&]*&+)*)q=([^&]*)&*(.*)
RewriteRule ^index.php$ /search-%3?%1%4 [L,R]

RewriteRule ^search-(.+) index.php?q=$1 [L,QSA]

第一项规则是将请求从外部转移,第二项是内部改写。

问题回答

如果你想在Gumbo建议的内容相反,即:转题/search-SEARCHTERM/index.php?q=SEARCHTERM&x=0&y=0,在您的“htaccess”档案中加入这样的内容:

RewriteEngine On
RewriteRule ^search-([-_A-Za-z0-9]+)$ /index.php?q=$1&x=0&y=0 [L]




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签