Web Hosting Forum | Lunarpages
News: Server Migrations to San Diego: Deneb, Felix and Tsohea are moving to San Diego starting Tuesday, December 30, 2008 at 10pm Pacific. They will complete their moves Friday night, January 2, 2009

Isis, Seth and Ez-web-n-mail will move physically on Friday, January 2, 2009

Please see the forum posts at http://www.lunarforums.com/lunarpages_web_hosting_server_information-b54.0/

+ Submit Your Own Web Site for the January 2009 Site of the Month Contest!
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
January 09, 2009, 02:18:59 PM


Login with username, password and session length


Pages: [1] 2   Go Down
  Print  
Author Topic: .htaccess help for add-on domain  (Read 297 times)
CRCs Reality
Trekkie
**
Offline Offline

Posts: 10


« on: September 12, 2008, 04:57:17 AM »

Hello, I've been lurking for a while trying to sort this out, but now I thought I'd ask..

I have a primary domain registered on Lunarpages ( www.lionsbrooke.com )

I also have another domain name I have registered elsewhere, that had been redirecting to my personal webserver that I have moved onto the Lunarpages account as an add-on domain ( www.crcs-reality.com )

All of that is working at this point . . .  However..

The actual lionsbooke.com site is in the "public_html/smf" directory
The actual crcs-reality.com site is in the "public_html/crcs-reality" directory.

I have the add-on domain set up right in cpanel, and both sites resolve and function correctly, but I'd like them to appear as only the domain name in the address bar when navigating the sites.

When navigating lionsbrooke.com, the address bar shows "http://www.lionsbrooke.com/smf" and when navigating crcs-reality.com the adress bar shows "http://www.lionsbrooke.com/crcs-reality"

Now, I know this can be done with a bit of tweaking of my .htaccess files, but I am at a loss on how to make it work. I've been working at it for a couple days and always end up rendering the sites offline until I restore my 'working' .htaccess files (thank god for backups!)..

The .htaccess file located in "public_html" contains:

Code:
AddHandler application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml
AddType application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml
RewriteEngine on

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^/?$ http://lionsbrooke.com/smf/ [R=301,L]

And the .htaccess file located in "public_html/crcs-reality" contains:

Code:
RewriteEngine on
AddHandler application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml

RewriteCond %{HTTP_HOST} ^crcs-reality.lionsbrooke.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.crcs-reality.lionsbrooke.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.crcs-reality.com$
RewriteRule ^/?$ http://www.lionsbrooke.com/crcs-reality/ [R=301,L]


Yes, I realize there is probably stuff in there I don't need......   Confused

Any guidance on how to modify these files to work the way I want?
I'd like all navigation within crcs-reality.com to show "http://www.crcs-reality.com" in the address bar, and all navigation within lionsbrooke.com to show as "http://www.lionsbrooke.com"

Thanks in advance !
Logged
vlad.panainte
SysAdmin
Spacescooter Operator
*****
Online Online

Posts: 30


« Reply #1 on: September 13, 2008, 02:25:35 AM »

Hello

Please try the following rewrite rule code:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.crcs-reality\.com$ [NC]
RewriteRule ^(.*)$ http://www.crcs-reality.com/$1 [R=301,L]

I hope this is helpful.
Thank you!
Logged
CRCs Reality
Trekkie
**
Offline Offline

Posts: 10


« Reply #2 on: September 13, 2008, 06:43:25 AM »

Not sure which .htaccess file I was supposed to try that on, so I tried it with both files, and both as an addition as well as replacing the existing file with this code..

No luck.

With this code, my page does not come up at all (internal server error)..

Any other ideas?
Logged
MrPhil
Quantum Encyclopedia Writer
*****
Offline Offline

Posts: 3578



« Reply #3 on: September 13, 2008, 07:43:09 AM »

Vlad's instructions won't work, because the public_html/.htaccess file will see your add-on as http://www.lionsbrooke.com/crcs-reality/. Try public_html/.htaccess with:

RewriteEngine On
RewriteRule  ^crcs-reality/?(.*)$  http://www.crcs-reality.com/$1  [R=301]
Logged

CRCs Reality
Trekkie
**
Offline Offline

Posts: 10


« Reply #4 on: September 13, 2008, 08:08:10 AM »

Changed my 'public_html/.htaccess" to:

Code:
AddHandler application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml
AddType application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml
RewriteEngine on

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^/?$ http://lionsbrooke.com/smf/ [R=301,L]

RewriteRule  ^crcs-reality/?(.*)$  http://www.crcs-reality.com/$1  [R=301]

And left the "public_html/crcs-reality/.htaccess" as it was..

No change at all..


should I be changing/removing the file in "public_html/crcs-reality/.htaccess" as well?  I feel like I'm missing something obvious . .
Logged
MrPhil
Quantum Encyclopedia Writer
*****
Offline Offline

Posts: 3578



« Reply #5 on: September 13, 2008, 08:42:16 AM »

Remove (or comment out with #) the pair

RewriteCond ...
RewriteRule ...


Was the intent to redirect anything to the smf directory? What exactly are you trying to do here? It will certainly interfere with your add-on domain's function.

Rename (or erase) public_html/crcs-reality/.htaccess to get it out of the way for now.
Logged

CRCs Reality
Trekkie
**
Offline Offline

Posts: 10


« Reply #6 on: September 13, 2008, 08:53:22 AM »

The intent is:

any inquirys to www.lionsbrooke.com should redirect to www.lionsbrooke.com/smf/, but the address bar should just show www.lionsbrooke.com

Any inquirys to www.crcs-reality.com should redirect to www.lionsbrooke.com/crcs-reality/, but the address bar should show www.crcs-reality.com

I have removed/renamed 'public_html/crcs-reality/.htaccess" (which now leaves www.crcs-reality.com offline, no response, OK for the moment as this isn't the primary domain and I can play with it a bit).

If I comment out the pair
RewriteCond ...
RewriteRule ...
www.lionsbrooke.com goes offline (or at least reverts to the tmp. index.html page siting in 'public_html"). . . .

I appreciate the help so far . . . .  just wish I could get this sorted out.
Logged
Troy L
Support
Galactic Royalty
*****
Offline Offline

Posts: 238


Darkwolf


« Reply #7 on: September 13, 2008, 09:07:52 AM »

Try the following:

In public_html .htaccess add:

RewriteEngine On
Options +FollowSymlinks

RewriteCond %{HTTP_HOST} lionsbrooke.com$
RewriteCond %{REQUEST_URI} !smf/
RewriteRule ^(.*)$ smf/$1

As long as you have the crcs-reality.com setup as an addon in cpanel and have it set to default to crcs-reality folder, this should work.  If not, add a blank .htaccess into the crcs-reality folder.

Advise if this doesnt work.
Logged

CRCs Reality
Trekkie
**
Offline Offline

Posts: 10


« Reply #8 on: September 13, 2008, 09:25:43 AM »

Try the following:

In public_html .htaccess add:

RewriteEngine On
Options +FollowSymlinks

RewriteCond %{HTTP_HOST} lionsbrooke.com$
RewriteCond %{REQUEST_URI} !smf/
RewriteRule ^(.*)$ smf/$1

As long as you have the crcs-reality.com setup as an addon in cpanel and have it set to default to crcs-reality folder, this should work.  If not, add a blank .htaccess into the crcs-reality folder.

Advise if this doesnt work.

OK, with this applied, Lionsbrooke.com works (although navigating the forums still shows "www.lionsbrooke.com/smf/" in the address bar)..

crcs-reality.com comes up as "500 internal server error"

 Confused
Logged
CRCs Reality
Trekkie
**
Offline Offline

Posts: 10


« Reply #9 on: September 13, 2008, 09:26:50 AM »

PS - yes, crcs-reality.com is set up as an add-on domain in cpanel with the crcs-reality folder...
Logged
MrPhil
Quantum Encyclopedia Writer
*****
Offline Offline

Posts: 3578



« Reply #10 on: September 13, 2008, 12:44:32 PM »

The problem here is that www.crcs-reality.com, being an add-on, will show up as www.lionsbrooke.com/crcs-reality/. The code that Troy provided will take any URI not  starting with "smf/" and stick "smf/" in front of it. This will turn a URI of "crcs-reality/" into "smf/crcs-reality/", which is incorrect.

I think you merely need to add a third Rewrite Condition:

RewriteCond  %{REQUEST_URI}  !crcs-reality/

to keep the add-on from being smf'd. I don't know why you're seeing the "smf" in the URL when it's redirected. Does this happen on the very first entry (http://www.lionsbrooke.com), or just on subsequent pages? If the latter, it may well be that the SMF code is internally providing links with "smf" already in them, in which case I doubt you can do much about it. You might try  adjusting the domain name settings (smf/Settings.php) to be "lionsbrooke.com" instead of "lionsbrooke.com/smf" (if that's what's there now), and let the new redirection take care of the "smf/" part.

At this point, URLs for crcs-reality.com should not have been modified (still lionsbrooke.com/crcs-reality/). Now you can use the code to rewrite this URL to the add-on:

RewriteRule  ^crcs-reality/?(.*)$  http://www.crcs-reality.com/$1  [R=301]

which should show as the add-on in the address bar. Remove any URL rewriting from crcs-reality/.htaccess.

P.S. Don't forget to clear your browser cache after any change to .htaccess.
Logged

Troy L
Support
Galactic Royalty
*****
Offline Offline

Posts: 238


Darkwolf


« Reply #11 on: September 13, 2008, 12:54:09 PM »

Looking at the site, it appears that may be what is going on.

Going to http://www.lionsbrooke.com is placing it at http://www.lionsbrooke.com/smf/ while retaining the http://www.lionsbrooke.com/ as the url, however further links are then causing the browser to go to http://www.lionsbrooke.com/smf/  which is indicative of smf itself being hardcoded to use /smf/ in the urls. 
Logged

CRCs Reality
Trekkie
**
Offline Offline

Posts: 10


« Reply #12 on: September 13, 2008, 01:49:20 PM »

You are both correct on why www.lionsbrooke.com was adding the /smf at the end . . .   Call it operator error in the configuration   Doh
It's much better now..

However . . . .

My subdomain of www.crcs-reality still refuses to show www.crcs-reality as the address instead of www.lionsbrooke.com/crcs-reality..

Currently, my "public_html/.htaccess" file reads :

Code:
AddHandler application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml
AddType application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} lionsbrooke.com$
RewriteCond %{REQUEST_URI} !smf/
RewriteRule ^(.*)$ smf/$1


Which has it working just fine . . .  No more problems there.

However, for www.crcs-reality.com . .

A blank .htaccess file leaves it offline (500 server error)

So I have reverted it to :
Code:
RewriteEngine on
AddHandler application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml

RewriteCond %{HTTP_HOST} ^crcs-reality.lionsbrooke.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.crcs-reality.lionsbrooke.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.crcs-reality.com$
RewriteRule ^/?$ http://www.lionsbrooke.com/crcs-reality/ [R=301,L]

Which puts the site online, but has it back to showing as www.lionsbrooke.com/crcs-reality , which won't work . . . .

I appreciate the help so far folks (truly), any input on how to get this last bit working would be gereat!
Logged
Troy L
Support
Galactic Royalty
*****
Offline Offline

Posts: 238


Darkwolf


« Reply #13 on: September 13, 2008, 03:50:51 PM »

You might wanna email support (support@lunarpages.com) or contact via support.lunarapages.com, and include the URL for this post.

Does seem odd that a blank .htaccess is causing ISE 500, so may need further looking into

Logged

CRCs Reality
Trekkie
**
Offline Offline

Posts: 10


« Reply #14 on: September 13, 2008, 03:58:10 PM »

Hmm . . .

I already called them . .  and, not to be mean if any of you work there..

I sat on hold for 30 minutes for a guy to come on and say "hmm, let me look at it...  "

As he was saying that, my site went offline

The he said "that's odd, I'm getting an error . .  Can you hold?"

Then he hung up on me and my site was offline (had been up before the call)..

I checked the .htaccess file and saw he had butchered it before he hung up on me..  I restored it from my backup (which brought the site back) and called them again..  Sat on hold for another 30 minutes, and was told "of course your site doesn't work right now, DNS propogation is happening..  Give it 2 or 3 days and call back"

I tried to explain that the site worked, but I needed a little help with the .htaccess file and I was told again to wait 2 or 3 days and call back..

So I posted here for help  Confused

I'm almost afraid to call them again after the last experience . . . . I mean, it works right now, just shows the wrong adress in the address bar . . . .  My last call in to support dropped the site and wasted over an hour of my time with zero results..


Logged
Pages: [1] 2   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.6 | SMF © 2006-2008, Simple Machines LLC

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM