Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在不更改URL的情况下重定向.htaccess文件_.htaccess_Mod Rewrite_Redirect_Url Redirection - Fatal编程技术网

如何在不更改URL的情况下重定向.htaccess文件

如何在不更改URL的情况下重定向.htaccess文件,.htaccess,mod-rewrite,redirect,url-redirection,.htaccess,Mod Rewrite,Redirect,Url Redirection,我想将几个页面重定向到带有GET变量的PHP页面。但是,当我尝试使用.htaccess文件时,它会重定向,但会更改URL。我不希望它在重定向时更改URL结构。我该怎么做 例如,我想将/fly snooze cruise重定向到http://example.com/package_listing.php?package-类型=飞行打盹巡航 和/fly snooze cruise/奥兰多机场至http://example.com/package_listing.php?package-类型=飞行打盹

我想将几个页面重定向到带有GET变量的PHP页面。但是,当我尝试使用.htaccess文件时,它会重定向,但会更改URL。我不希望它在重定向时更改URL结构。我该怎么做

例如,我想将
/fly snooze cruise
重定向到
http://example.com/package_listing.php?package-类型=飞行打盹巡航

/fly snooze cruise/奥兰多机场
http://example.com/package_listing.php?package-类型=飞行打盹巡航&机场=奥兰多机场

这是我的.htaccess代码:

Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteBase /

RewriteRule ^fly-snooze-cruise$ http://www.example.com/package_listing.php?package-type=fly-snooze-cruise [L]
RewriteRule ^fly-snooze-cruise/orlando-airport$ http://www.example.com/package_listing.php?package-type=fly-snooze-cruise&airport=orlando-airport [L]
RewriteRule ^fly-snooze-cruise/orlando-sanford-airport$ http://www.example.com/package_listing.php?package-type=fly-snooze-cruise&airport=orlando-sanford-airport [L]
RewriteRule ^fly-snooze-cruise/melbourne-airport$ http://www.example.com/package_listing.php?package-type=fly-snooze-cruise&airport=melbourne-airport [L]
RewriteRule ^snooze-park-cruise$ http://www.example.com/package_listing.php?package-type=snooze-park-cruise [L]

如果您不想更改浏览器中的url,请从重写目标中删除Http和主机名。@Starkeen是的,这就解决了它。谢谢。如果您不想更改浏览器中的url,请从重写目标中删除Http和主机名。@Starkeen是的,这就解决了它。谢谢