【发布时间】:2014-01-16 05:45:09
【问题描述】:
请多多包涵,我不知道如何解释我的问题,而且我是 mod re_writing 的新手,我有两页
- index.php
- search.php
index.php 有一个搜索字段和一个可以获取数据的 div。搜索字段使用 Ajax 从数据库中提供即时结果。
作为
具有即时结果的搜索字段
当我在 index.php 上时,它给了我正确的结果,在这里我使用了一个重写规则,它变成了
http://localhost/user_profiles/index?u=tol
进入
http://localhost/user_profiles/index/u/tol
并给我个人资料视图
两个网址都给了我正确的结果,但问题在于 ajax,当我打开时
http://localhost/user_profiles/index?u=tol
ajax 工作得很好,给了我正确的结果,但是当我在
http://localhost/user_profiles/index/u/tol
它给出了奇怪的结果
我不知道如何解决这是我的 re_write 规则
Options +FollowSymLinks
RewriteEngine on
RewriteRule u/(.*) index.php?u=$1 [L,QSA]
index.php 的另一个规则只是索引
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
我的 ajax 查询是
maq.open('GET','search?q='+userVal,true);
请帮帮我。
【问题讨论】:
标签: php ajax .htaccess mod-rewrite