我正在尝试重写我的网址:
RewriteEngine On
RewriteBase /
RewriteRule ^help/(.+)/(.+) help.php?helpid=$2
RewriteRule ^city/(.+)/(.+) city.php?cityid=$2
甚至该 url 包含预期的格式:http ://example.com/help/the-irelevant-title/5/
看起来
isset($_GET['helpid']))
false
总会开火help.php
通常这个系统对我有用。我在这里缺少什么吗?
-编辑-
正如我所看到的,这应该有效(或至少你们中的一个人回答)我正在为问题添加更多代码:
完整的 .htaccess 内容
RewriteEngine On
ErrorDocument 500 /oohps.php
ErrorDocument 404 /oohps.php
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
RewriteBase /
RewriteRule ^help/([^/]+)/([^/]+) help.php?helpid=$2 [QSA]
RewriteRule ^city/([^/]+)/([^/]+) city.php?cityid=$2 [QSA]
RewriteRule ^login$ login.php
help.php 的开始
session_start();
error_reporting(E_ALL);
ini_set('display_errors', '1');
$_GET['noseo'] = true;
include('htmlhead.php');
/* Leemos la id del grupo*/
$selected;
if(isset($_GET['helpid'])){
$selected = $_GET['helpid'];
}else {
echo '<script>alert("Modrewrite fails. Id is missing, id: '.$_GET['helpid'].'");location.href = "/"</script>'; /* Allways returns this*/
}