【发布时间】:2017-04-16 01:52:41
【问题描述】:
我正在尝试在我正在本地处理的网站上创建干净的 URL。
我正在使用 WampServer。
这是我的.htaccess 内容
RewriteEngine on
RewriteRule ^search/([0-9a-zA-Z]+) search.php?semt=$1 [NC,L]
这是我在search.php 文件中所做的事情。
<?php
if(!isset($_GET["semt"]) || empty($_GET["semt"])){
header("Location: index.php");}
else{
$region = $_GET["semt"];
include('database/config.php');
include('includes/header.php');}
?>
当我打字时,
localhost/project/search.php?semt=xxx 它非常有效。
当我打字时,
本地主机/项目/搜索/xxx
它不工作。浏览器出现此错误。
此页面无法正常工作
localhost 将您重定向了太多次。 尝试清除您的 cookie。 ERR_TOO_MANY_REDIRECTS
链接的最终版本是这样的。
localhost/project/search/index.php
我该如何解决这个问题?
【问题讨论】:
-
xxx是您实际使用的,还是代表其他东西? -
为例。我尝试使用
RewriteRule ^esc/search/([0-9a-zA-Z]+) localhost/esc/search.php?semt=$1 [NC,L],但没有成功。
标签: php apache .htaccess redirect