Jump to content

[Solved] queueing of www "subdomain" Rewrites


CB Admin

Recommended Posts

Hello!

 

First:

 

Username: chorbrev

Domain: [www.]chorusbreviarii.org

 

We've installed a Ruby app. The direct url w/port -- http://www.chorusbreviarii.org:12408/ -- works fine, with or without the "www." ...

Also working fine, via a rewrite rule: http://chorusbreviarii.org/

 

However, nothing I've tried will get http://www.chorusbreviarii.org/ to work. Rewrite rules in any form will not match against the

form with "www".

 

Any ideas? Thanks much for any suggestions or help you can give me! :)

 

 

 

Link to comment
Share on other sites

byron: you can always check it out over shell :)

 

CB Admin: you just needed to take out the "^" from your RewriteCond line. That character in a regex anchors the match to the start of a line, thereby forcing the match to only occur on the main domain.

 

It should be working now.

Link to comment
Share on other sites

CB Admin: you just needed to take out the "^" from your RewriteCond line. That character in a regex anchors the match to the start of a line, thereby forcing the match to only occur on the main domain.

 

It should be working now.

 

Hi byron & djbob! Sorry for my slow follow-up, but thanks for the help. Yes, it's working now. :)

 

I didn't think of that for the RewriteCond line -- I guess I was too focused on the RewriteRule's! :-P

 

Nonetheless, I'm not sure why the rewrite rule lines given before -- which separately consider both names -- didn't work for our www. name. But now they do -- just tried. (Please see those below.) Did you do something else besides remove the caret, djbob?

 

BTW... I guess you know that cPanel's management of rewrite rules in our main .htaccess file -- at least where Ruby and your proxy server are concerned -- really seems to suck. Even aside from the placement of rules that didn't work, it would add rules at the ending of other lines -- breaking the file! -- nor would it actually delete rules previously added when commanded to do so. My only resort was to hand-edit. Perhaps my experience is not the norm; but if not, I'd sure like to know why.

 

Thanks again for your help, and TIA for any comments on the above.

 

Following, for byron's sake ;-) and for reference to the above, are my rewrite lines, with commented-out lines I had tried earlier. (I replaced for this post the actual app/proxy port number with "NNNNN".)

 

Cheers,

 

-cba

 

======================================================

 

RewriteCond %{HTTP_HOST} chorusbreviarii.org$

RewriteRule .* "http\:\/\/127\.0\.0\.1\:NNNNN%{REQUEST_URI}" [P,L]

 

#############################################################################

#

# This is the style of rule spit out by cPanel. It works... barely.

# Images and style elements are missing. (?)

#

# RewriteRule ^/?$ "http\:\/\/127\.0\.0\.1\:NNNNN%{REQUEST_URI}" [P,QSA,L]

#

 

 

#

# Before, these would work for chorusbreviarii.org, but not for

# www.chorusbreviarii.org ... Now they work for both. (?)

#

 

# RewriteCond %{HTTP_HOST} ^chorusbreviarii.org$

# RewriteRule .* "http\:\/\/127\.0\.0\.1\:NNNNN%{REQUEST_URI}" [P]

#

# RewriteCond %{HTTP_HOST} ^www.chorusbreviarii.org$

# RewriteRule .* "http\:\/\/127\.0\.0\.1\:NNNNN%{REQUEST_URI}" [P,L]

 

 

# RewriteCond %{HTTP_HOST} ^chorusbreviarii.org$ [OR]

# RewriteCond %{HTTP_HOST} ^www.chorusbreviarii.org$

# RewriteRule .* "http\:\/\/127\.0\.0\.1\:NNNNN%{REQUEST_URI}" [P,L]

 

======================================================

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...