没有重定向htaccess的重写重写、重定向、htaccess

2023-09-02 09:53:48 作者:橙熟 ˇ柚稚

所有我想要做的就是重写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]