Domain alias

Using a single web hosting account to host multiple sites

Domain alias

Postby jeremybass » Thu Jun 05, 2008 10:12 am

Hello,

I'm needing to have a site www.MYSITE.com/Other site/
become www.Other site.com

Othersite.com is the alias of the root www.MYSITE.com as of now hosted on godaddy... not forwarded

there is a rewrite for www.MYSITE.com/index.php?page=Other site
to make it www.MYSITE.com/Other site/
and I'm not wanting to be hit on the google issues of redirects...




any ideas would be great thanks....


Some other forums I questioned in that my give a better idea if not clear on this...
http://www.experts-exchange.com/Software/Server_Software/Web_Servers/Apache/Q_23455236.html

http://forum.cmsmadesimple.org/index.php/topic,22564.0.html


.htaccess file as of now which works for the rewrite for www.MYSITE.com/index.php?page=Other site
to make it www.MYSITE.com/Other site/

Code: Select all
# BEGIN Optional settings

# Turns off directory browsing
# not absolutely essential, but keeps people from snooping around without
# needing empty index.html files everywhere
Options -Indexes

# Deny access to config.php
# This can be useful if php ever breaks or dies
# Use with caution, this may break other functions of CMSms that use a config.php
# file.  This may also break other programs you have running under your CMSms
# install that use config.php.  You may need to add another .htaccess file to those
# directories to specifically allow config.php.
<Files "config.php">
order allow,deny
deny from all
</Files>

# Sets your 403 error document
# not absolutely essential to have,
# or you may already have error pages defined elsewhere
ErrorDocument 403 /forbidden403.shtml

# No sense advertising what we are running
ServerSignature Off

# END Optional Settings

# BEGIN CMSMS and Rewrite Rules
# Make sure you have Options FollowSymLinks
# and Allow on

RewriteEngine On

# Might be needed in a subdirectory
#RewriteBase /

# URL Filtering helps stop some hack attempts
#IF the URI contains a "http:"
RewriteCond %{QUERY_STRING} http\: [OR]
#OR if the URI contains a "["
RewriteCond %{QUERY_STRING} \[ [OR]
#OR if the URI contains a "]"
RewriteCond %{QUERY_STRING} \] [OR]
#OR if the URI contains a "<script>"
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
#OR script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
#OR any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule ^.*$ - [F,L]
# END Filtering

# CMSMS Rewriting
# Set assume mod_rewrite to true in config.php and clear CMSMS cache
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
# END CMSMS

# END Rewrite rules
jeremybass
 
Posts: 9
Joined: Thu Jun 05, 2008 9:59 am

Postby richardk » Thu Jun 05, 2008 3:53 pm

Add
Code: Select all
RewriteCond %{HTTP_HOST} ^(www\.)?othersite\.com$ [NC]
RewriteCond %{SCRIPT_FILENAME} !-f [NC]
RewriteCond %{SCRIPT_FILENAME} !-d [NC]
RewriteRule ^(.*)$ /index.php?page=othersite/$1 [QSA,L]

before
Code: Select all
RewriteCond %{REQUEST_FILENAME} !-f [NC]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby jeremybass » Fri Jun 06, 2008 7:54 am

Well I realize that it'd have to happen after the frist rewrite... so

www.MYSITE.com/Othersite/
becomes
www.Othersite.com

and

www.MYSITE.com/Othersite/itsPages
becomes
www.Othersite.com/itsPages

as
the oragin is
www.MYSITE.com/index.php?page=Othersite
and
www.MYSITE.com/index.php?page=itsPages
which is why the

www.MYSITE.com/Othersite/
becomes
www.Othersite.com

Happens before the
www.MYSITE.com/Othersite/itsPages
becomes
www.Othersite.com/itsPages
as the CMS writes the hierarchy

Any ideas on that? Thank you for the help...
jeremybass
 
Posts: 9
Joined: Thu Jun 05, 2008 9:59 am

Postby jeremybass » Fri Jun 06, 2008 10:30 am

Hope this all make sense...
which is why the

www.MYSITE.com/Othersite/
becomes
www.Othersite.com

Happens before the
www.MYSITE.com/Othersite/itsPages
becomes
www.Othersite.com/itsPages
as the CMS writes the hierarchy
jeremybass
 
Posts: 9
Joined: Thu Jun 05, 2008 9:59 am

Postby richardk » Mon Jun 09, 2008 12:42 pm

Try
Code: Select all
Options +FollowSymLinks -Indexes
ErrorDocument 403 /forbidden403.shtml
ServerSignature Off

<Files "config.php">
  Order allow,deny
  Deny from all
</Files>

RewriteEngine On

# START Filtering
RewriteCond %{QUERY_STRING} http\: [NC,OR]
RewriteCond %{QUERY_STRING} \[ [OR]
RewriteCond %{QUERY_STRING} \] [OR]
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [NC,OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2}) [NC]
RewriteRule .* - [F,L]
# END Filtering

# START CMSMS
RewriteCond %{HTTP_HOST} ^(www\.)?mysite\.com$ [NC]
RewriteRule ^othersite(/(.*))?$ http://www.othersite.com/$2 [R=301,L]

RewriteCond %{HTTP_HOST} ^(www\.)?othersite\.com$ [NC]
RewriteCond %{SCRIPT_FILENAME} !-f [NC]
RewriteCond %{SCRIPT_FILENAME} !-d [NC]
RewriteRule ^(.*)$ /index.php?page=othersite/$1 [QSA,L]

RewriteCond %{HTTP_HOST} ^(www\.)?mysite\.com$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ /index.php?page=$1 [QSA]
# END CMSMS
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby jeremybass » Mon Jun 09, 2008 1:02 pm

Well not sure what happened, though there was no errors it just keeped going to the root (http://www.dwproductions.com/) any ideas on that?
Code: Select all
# START CMSMS
RewriteCond %{HTTP_HOST} ^(www\.)?dwproductions\.com$ [NC]
RewriteRule ^huntereducation(/(.*))?$ http://www.huntereducation.com/$2 [R=301,L]

RewriteCond %{HTTP_HOST} ^(www\.)?huntereducation\.com$ [NC]
RewriteCond %{SCRIPT_FILENAME} !-f [NC]
RewriteCond %{SCRIPT_FILENAME} !-d [NC]
RewriteRule ^(.*)$ /index.php?page=HunterEducation/$1 [QSA,L]

RewriteCond %{HTTP_HOST} ^(www\.)?dwproductions\.com$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ /index.php?page=$1 [QSA]
# END CMSMS
jeremybass
 
Posts: 9
Joined: Thu Jun 05, 2008 9:59 am

Postby richardk » Mon Jun 09, 2008 1:52 pm

Which URL are you accessing? Do all of them go to the root?

Try
Code: Select all
# START CMSMS
# Redirect dwproductions.com/huntereducation/* to huntereducation.com/*
RewriteCond %{HTTP_HOST} ^(www\.)?dwproductions\.com$ [NC]
RewriteRule ^huntereducation(/(.*))?$ http://www.huntereducation.com/$2 [NC,R=301,L]

# Rewrite huntereducation.com/* to /index.php?page=HunterEducation/*
RewriteCond %{HTTP_HOST} ^(www\.)?huntereducation\.com$ [NC]
RewriteCond %{SCRIPT_FILENAME} !-f [NC]
RewriteCond %{SCRIPT_FILENAME} !-d [NC]
RewriteRule ^(.*)$ /index.php?page=HunterEducation/$1 [QSA,L]

# Rewrite dwproductions.com/* to /index.php?page=*
RewriteCond %{HTTP_HOST} ^(www\.)?dwproductions\.com$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ /index.php?page=$1 [QSA]
# END CMSMS

Also try each part individually to see if they work alone.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby jeremybass » Tue Jun 10, 2008 7:26 am

HunterEducation.com is alaised to the root, as index.php is located there,

index.php is of dwprocutions.com

so www.HunterEducation.com is = to www.dwprocutions.com/index.php?page=HunterEducation
and
www.dwprocutions.com = www.dwprocutions.com/index.php

but as the cms writes the pages from the index.php

under HunterEducation.com

www.HunterEducation.com/links is = to index.php?page=links
as the cms/.htaccess will auto write the URI with the hierarchy in mind....

so the order would be that

1.)www.dwprocutions.com/index.php?page=HunterEducation
ending up as www.dwprocutions.com/HunterEducation

and then
2.)www.dwprocutions.com/HunterEducation needs to be writen as
HunterEducation.com


so that www.dwprocutions.com/HunterEducation/links
would be
www.HunterEducation.com/links
but
www.dwprocutions.com/links would stay the same as
www.dwprocutions.com/links

Godaddy said that want them both to point at the root, other wise this would end up in a loop casueing a 500 error... hope that make sense... thanks for the help... :)
jeremybass
 
Posts: 9
Joined: Thu Jun 05, 2008 9:59 am

Postby richardk » Wed Jun 11, 2008 2:51 pm

Try the three pieces of mod_rewrite separately, i need to know which bits work.

Code: Select all
# Redirect dwproductions.com/huntereducation/* to huntereducation.com/*
RewriteCond %{HTTP_HOST} ^(www\.)?dwproductions\.com$ [NC]
RewriteRule ^huntereducation(/(.*))?$ http://www.huntereducation.com/$2 [NC,R=301,L]

Go to dwprocutions.com/HunterEducation, are you redirected to huntereducation.com?

Code: Select all
# Rewrite huntereducation.com/* to /index.php?page=HunterEducation/*
RewriteCond %{HTTP_HOST} ^(www\.)?huntereducation\.com$ [NC]
RewriteCond %{SCRIPT_FILENAME} !-f [NC]
RewriteCond %{SCRIPT_FILENAME} !-d [NC]
RewriteRule ^(.*)$ /index.php?page=HunterEducation/$1 [QSA,L]

When you go to huntereducation.com/links does it rewrite to /index.php?pages=HunterEducation/links? (If you replace QSA with R you will see any change in the address bar of your browser.)

Code: Select all
# Rewrite dwproductions.com/* to /index.php?page=*
RewriteCond %{HTTP_HOST} ^(www\.)?dwproductions\.com$ [NC]
RewriteCond %{SCRIPT_FILENAME} !-f [NC]
RewriteCond %{SCRIPT_FILENAME} !-d [NC]
RewriteRule ^(.+)$ /index.php?page=$1 [QSA,L]

When you go to dwproductions.com/links does it rewrite to /index.php?pages=links? (If you replace QSA with R you will see any change in the address bar of your browser.)
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby jeremybass » Fri Jun 13, 2008 7:39 am

As I truns out

one of you middle suggestions
Code: Select all
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
RewriteCond %{HTTP_HOST} huntereducation\.com [NC]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule .* /HunterEducation



workes if i write this to my config.php file:
$config['root_url'] = 'http://' . $_SERVER['HTTP_HOST'];

This set all links to were the URI is writen to... worked like a charm.... there is less server rewriting and less chance of errors.... Thank you for you help... and hopfully this help someone else as well... have a great one... :)
jeremybass
 
Posts: 9
Joined: Thu Jun 05, 2008 9:59 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 1 guest

cron