Htaccess rewrite without redirection

All I want to do is rewrite the URL from www.exaple.hu to www.exaple.cz/hu. Therefore, the contents of the address www.exaple.hu are displayed at www.exaple.cz/hu.

Therefore, when the user enters www.exaple.cz/hu, the user is not redirected to www.exaple.hu, but the content from www.exaple.hu is displayed in the domain www.exaple.cz/hu (therefore www.exaple is in the address bar .cz / hu).

+5
source share
3 answers

To do this, you need to enable mod_proxy in your Apache configuration. After mod_proxy is enabled, enable mod_rewrite and .htaccess through httpd.conf, and then put this code in .htaccessa directory DOCUMENT_ROOT:

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]
+6

www.exaple.cz/hu www.exaple.hu ?

, , www.exaple.cz/hu www.exaple.hu.

, A :

  • /var/www/html/A, : www.exaple.cz/hu
  • /var/www/html/B, : www.exaple.hu

cd/var/www/html/

ln -s/var/www/html/B A

, , , .

URL- diff, slink or.. "www.exaple.hu" www.exaple.cz/hu?

+2

, (cpanel) , .

:

<a href="/path/page">Link</a>

Now you can use the new site without any problems.

+1
source

All Articles