Hi guys (yeah, I know you missed me...).
I use the multisite (clone zenphoto plugin, yes !) and I have two domain names :
site1.com > main installation
site2.com > cloned installation
The main installation runs fine on site1.com but I don't understand how to configure .htaccess for the cloned gallery in order to use site2.com for it (I hope it's clear).
Any idea ?
Hi Acrylian,
yes, I realized that but I'd like to use the domain name site2.com for the cloned installation in a "transparent" way.
To be clearer, I want my .htaccess to replace in the navigation bar http://www.site1.com/site2/ by http://www.site2.com.
Am I clear ?
For better overview on the webspace I would recommend this:
Put both installs in folders /site1 and /site2 on your webspace root and then link the domains to those folders. They are then the "root" for those domains. I am sure your host has something for that on its webspace admin. If not you could redirect via a htaccess in the root to those folders.
If you have more than one domain each site you need to make one to the main domain ("Duplicated content" avoiding). You then could do that via a htcacess in the root, too.
In fact the folders are already set and used like that and I can't change it (for production cause).
I just need http://www.site1.com/site2/ to be replaced by http://www.site2.com as if it was the root.
What I am looking for is a way to do this in the .htaccess to get it...
The installation is like that :
site2 is in a subdirectory of the site1 root.
The .htaccess are already rewrited base :
site1.com .htaccess :
`
IndexIgnore *
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.$ - [L]
RewriteRule ^./?$ index.php [L,QSA]
RewriteCond %{HTTP_HOST} ^site2.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.site2.com$
RewriteRule ^/?$ "http\:\/\/www.site1.com\/site2/" [R=301,L]
site2.com .htaccess :
IndexIgnore *
RewriteEngine On
RewriteBase /site2
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [L]
RewriteRule ^.*/?$ index.php [L,QSA]
`
But when I try to connect to site2.com, I'm redirected to site1.com.
Something must be wrong, but... what ?
Again it would be all easier if you would redirect the domain via your host directly to the /site2 folder.
Also your domain redirection should go before the other rewrite ones. Also one rewriteCond per one RewriteRule.
Try this:
RewriteCond %{HTTP_HOST} ^site2\.com$ [NC] RewriteRule ^(.*)$ http://www.site1.com/site2/$1 [L,R=301]
An then no RewriteBase /site2 but RewriteBase /. There is no folder used anymore if you redirect it!
Hi,
"Again it would be all easier if you would redirect the domain via your host directly to the /site2 folder. "
Already done.
I've made the change but site2 is still redirected to site1.
Here are the .htaccess :
Site1.com :
`
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [L]
RewriteRule ^.*/?$ index.php [L,QSA]
IndexIgnore *
Site2.com :
IndexIgnore *
RewriteEngine On
RewriteCond %{HTTP_HOST} ^site2.com$ [NC]
RewriteRule ^(.*)$ http://www.site1.com/site2/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [L]
RewriteRule ^.*/?$ index.php [L,QSA]
`
Site2.com is still redirected to site1.com.
Help (I need somebody, heeeelp).
So you already redirected the site2.com domain to the /site2 folder? Then you don't need to do the same using htaccess… And if you are already on the site there is nothing to redirect via that sites htaccess because that itself now redirects back to site1.com/site2 again…
You are really over complicating things here…
Then, site2.com is still redirected to site1.com.
.htaccess site1 :
`
IndexIgnore *
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [L]
RewriteRule ^.*/?$ index.php [L,QSA]
.htaccess Site2 :
IndexIgnore *
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [L]
RewriteRule ^.*/?$ index.php [L,QSA]
`
Stuck.
I think you really need to study rewrite rules.
First you need either a rewrite base or you need to explicitly include folder names or your file tests and redirects will most likely look in the wrong place. Then your config file will need to have have explicit defines for the WEB and server paths because zenphoto will not be able to sort things out.
I am at a loss as to why you do point your domains directly to the correct folder and let everything work normally. If you actually succeed the way you are going you will have created for yourself a maintenance nightmare.
Again, you are really overcomplicating things. As long as you have both sites under separate domains there is no change to any of the sites. Production or not.
Really, again my suggestion to put both in their own folders in the root of your webspace and redirect the domains via your webhost's interface to those folders. Then run setup on each or change the rewritebase htaccess entry to rewriteBase / and you are done. Nothing will change for any visitor and you have both sites clean separated.
If the 2nd is a clone you might needto re-clone the files but as long as you use the same database credentials on that clone (save the config file) and same albums also nothing will be harmed.
It is really that simple.