1

I want to load another site page using .htacces file. Eg: I have two sites A and B

If i open (site A )https://www.dev.example.com I want to load (site B page) https://www.example.com/test/id/1 page as it.

We can do this using Jquery/Moo-tools I i don't want to do it using Jquery Load function because its mainly work good for simple HTML page but my another page is too heavy and contain lot of Ajax based features

Thanks,

  • No, you cannot do this for obvious reasons. Also, this question is a dupe of http://stackoverflow.com/questions/987343/how-can-i-redirect-to-a-different-domain-without-changing-the-url-in-the-address – Johan Jul 05 '14 at 08:02

2 Answers2

0

I think that you can do it like this for permanent redirect.

RewriteCond %{HTTP_HOST} dev\.example\.com [NC] 
RewriteRule ^(.*)$ https://www.example.com/test/id/1$1 [L,R=301]

And just change the R=301 with R for non permanent redirect

You can read more about htaccess here http://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/

papa zulu
  • 317
  • 5
  • 16
0

Try this:

RewriteEngine On
RewriteCond %{HTTP_HOST} www\.dev\.example\.com [NC]
RewriteCond %{HTTPS} on
RewriteRule ^/?$ https://www.example.com/test/id/1 [L,R]

Once you are satisfied that the redirect works, you can change the R to R=301 to make it permanent.

This assumes that mod_rewrite is both installed and activated for htaccess files. If you are not sure, to check if mod_rewrite is installed, look at the list of installed modules in the output of phpinfo(); By default, mod_rewrite is not enabled for htaccess files. If you are managing your own server, open httpd.conf and make sure that the webroot directory block contains one of these lines: AllowOverride FileInfo or AllowOverride All

zx81
  • 41,100
  • 9
  • 89
  • 105