使用.htaccess重定向而不更改URL [英] Redirect Without Changing URL using .htaccess

查看:240
本文介绍了使用.htaccess重定向而不更改URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从图片网址重定向到网址。



即nevil120.herobo.com/images/Chrysanthemum.jpg



nevil120.herobo.com/index.php?image=free



重定向应该发生但是不应该在浏览器中更改url 。网址应保留为nevil120.herobo.com/images/Chrysanthemum.jpg,页面应加载。



如何通过.htaccess的重定向规则实现?

解决方案

试试这段代码


RewriteEngine
选项+ FollowSymLinks
RewriteCond%{REQUEST_URI} ^ / tour
RewriteRule ^(。*)


/ [P]


I want to redirect to page url from image url.

i.e. nevil120.herobo.com/images/Chrysanthemum.jpg
to
nevil120.herobo.com/index.php?image=free

The redirection should happen but url should not be changed in browser. Url should remain as "nevil120.herobo.com/images/Chrysanthemum.jpg" and page should load.

How to achieve it through redirection rules of .htaccess?

解决方案

Try this code


RewriteEngine On
Options +FollowSymLinks
RewriteCond %{REQUEST_URI} ^/tour
RewriteRule ^(.*)


/ [P]


这篇关于使用.htaccess重定向而不更改URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆