Forum Moderators: phranque

Message Too Old, No Replies

Creating a microsite in joomla 1.5 with rewriting url

         

mhictnl

7:33 am on Jan 26, 2012 (gmt 0)

10+ Year Member



I have an issue with implementing a microsite within a joomla 1.5 CMS with it's own template and domainname.

Here is what I try to do:

I have a mainsite (http://www.mainsite.com) which is a joomla 1.5 running website.

I have a new domainname [microsite.com...] for the implementation of a new subsite of the mainsite, but wnat to make it look independant from the mainsite.

The mainsite has already a rewrite, because the the site is installed in a subdirectory (called www) from the documentroot of the server (/public_html/www/...).

I've already set up the microsite succesfully and is now running by using [mainsite.com...] But i want the new url to be displayed instead of the mainsite. So I tried several rewrites in the .htaccess file and redirects within cpanel ut none of the solutions worked out correctly.

So when entering the url [microsite.com...] I want to display the contents of the url [mainsite.com...] but still see the url [microsite.com...]

Does anyone know how to get this working with rewriting the htaccess file?

The redirection of the subdirectory is done by the following code in the htaccess file in the documentroot (not in the joomla subdir):


########## Begin rewrite to subdir
RewriteCond %{HTTP_HOST} ^mainsite\.com$
RewriteRule (.*) http://www.mainsite.com/$1 [R=301,L]

# If you want an external redirect, set the R flag there as well:
RewriteRule ^$ /www [L,R=301]

#Match all www and do a permanent redirect from www.example.com to example.com
#RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
#RewriteRule ^(.*)$ http://%1/$1 [R=301,NC,L]

#Ok, now get rid of that joomla directory in the resulting url.
RewriteCond %{REQUEST_URI} !^/www/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ /www/$1 [L]
RewriteRule ^(/)?$ www/index.php [L]
########## End

g1smd

8:07 am on Jan 26, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The very first step is to change the links on the page so they point to the right domain name. Have you done that?

You'll need two sets of rewrites. One for each domain name. Each one will need to test which domain name was requested so that only one of the rewrites will kick in for any particular request.

mhictnl

7:12 am on Jan 30, 2012 (gmt 0)

10+ Year Member



Hello g1smd, could you be a bit more precise? Maybe you can post some example rewrite code?

lucy24

10:45 am on Jan 30, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Rule #1: Use "example.com" to keep your examples from turning into clickable links. People need to see what you typed, not go to the site! If you need to show more than one domain name, you can use example.org or example.net.

... and speaking of multiple domain names, is this veering into Proxy territory? Or do they both live in the same place? Is the DNS set up to point everyone into the same directory? There can be further subdirectories, but everyone has to pass through the same htaccess or else it gets messy.