.htaccess 使用htaccess屏蔽URL(带参数)

.htaccess 使用htaccess屏蔽URL(带参数),.htaccess,mod-rewrite,url-masking,.htaccess,Mod Rewrite,Url Masking,我需要用一个相对简单的带有htaccess的URL来屏蔽一个长而愚蠢的php URL。 例如,我需要遮罩- http://mysite.com/index.php?this=that&this=that&whatevs=this&that=&id=5 使用这个简单的URL- http://mysite.com/mypage.php 我知道php可以通过获取页面的内容并显示它来非常轻松地完成这项工作。但在我的情况下,ajax调用和其他一些东西存在一些问题 此外,

我需要用一个相对简单的带有htaccess的URL来屏蔽一个长而愚蠢的php URL。 例如,我需要遮罩-

http://mysite.com/index.php?this=that&this=that&whatevs=this&that=&id=5
使用这个简单的URL-

http://mysite.com/mypage.php
我知道php可以通过获取页面的内容并显示它来非常轻松地完成这项工作。但在我的情况下,ajax调用和其他一些东西存在一些问题

此外,我更喜欢使用htaccess。我做了一些研究,但是htaccess代码让我很困惑。

所以你只想重定向到

然后使用以下规则:

RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} this=that&this=that&whatevs=this&that=&id=5
RewriteRule ^index.php$ http://mysite.com/mypage.php? [L,R=301]

我冒昧地从
mypage.php
中删除了
.php
部分,因为它没有真正的用途,并且使url看起来不那么漂亮

RewriteEngine On
RewriteBase /
RewriteRule ^mypage$ /index.php?this=that&this=that&whatevs=this&that=&id=5 [L,QSA]