没有重定向htaccess的重写 [英] htaccess rewrite without redirect

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

问题描述

所有我想要做的就是重写URL从www.exaple.hu到www.exaple.cz/hu~~V。因此,在地址www.exaple.cz/hu从联系地址www.exaple.hu显示的内容。

All i want to do is to rewrite url from www.exaple.hu to www.exaple.cz/hu. So under address www.exaple.cz/hu is displayed content from adress www.exaple.hu.

因此​​,当用户类型www.exaple.cz/hu,用户的不可以重定向到www.exaple.hu但www.exaple.hu的内容按域www.exaple.cz/显示胡(所以在地址栏中为www.exaple.cz/hu)。

So when user type www.exaple.cz/hu, user is not redirected to www.exaple.hu but content from www.exaple.hu is displayed under domain www.exaple.cz/hu (so in adress bar is www.exaple.cz/hu).

推荐答案

您将需要启用的mod_proxy在Apache配置为。一旦mod_proxy的启用,通过的httpd.conf 启用了mod_rewrite和.htaccess,然后把这个code在的.htaccess DOCUMENT_ROOT 目录下:

You will need to enable mod_proxy in your Apache config for that. Once mod_proxy is enabled, enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^www\.exaple\.cz$ [NC]
RewriteRule ^(hu)/?$ http://www.exaple.$1 [L,P,NC]

这篇关于没有重定向htaccess的重写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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