Welcome Guest | Login

.htaccess, mod_rewrite, & cpanel (& mint)

So i've installed a rails app, radiantCMS. It's great; it also uses mod_rewrite to leave clean url's. I'm not huge into regex (though i've been meaning to learn more) so i was hoping there was someone who could help me out with this.

I'm hoping I can add two exclusions to my .htaccess file, one to let me access my cpanel, and one to let me access my mint installation.

/cpanel/
/mint/

both of these render 404's. Can this be fixed using mod_rewrite? or should it be an internal fix to radiantCMS?

Thanks in advance.

2006-12-15 09:49 PM

Hey good question.  Every default Rails .htaccess that is generated actually has a little lesson in it how to do this...
# If you don't want Rails to look in certain directories,
# use the following rewrite rules so that Apache won't rewrite certain requests
#
# Example:
#   RewriteCond %{REQUEST_URI} ^/notrails.*
#   RewriteRule .* - [L]
So for you, underneath this section you would put:
   RewriteCond %{REQUEST_URI} ^/mint.*
  RewriteRule .* - [L]

  RewriteCond %{REQUEST_URI} ^/cpanel.*
  RewriteRule .* - [L]
Let me know how it goes,

Cheers,

~William

2006-12-16 01:21 AM

seems logical enough.

i tried it, but no luck with mint. cpanel worked fine. strange, eh?

here's all the rewrite stuff from my .htaccess file.
RewriteEngine On
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
RewriteCond %{REQUEST_URI} ^/mint.*
RewriteRule .* - [L]
RewriteCond %{REQUEST_URI} ^/cpanel.*
RewriteRule .* - [L]

2006-12-16 11:17 AM

here's what i did to get it working:

RewriteRule ^$ index.html [QSA]
# RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
# RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
RewriteCond %{REQUEST_URI} ^/mint.*
RewriteRule .* - [L]
RewriteCond %{REQUEST_URI} ^/cpanel.*
RewriteRule .* - [L]  
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

mod_rewrite is crazy.

2006-12-16 12:15 PM

revisiting this issue, would this .htaccess cause subdomains to become non-accessible? seems to  be the case for some reason.

2007-01-02 10:32 AM

For subdomains you'll have to add that 'notrails' section that the Rails .htaccess talks about.  Let me know if you need assistance with this.  

2007-01-02 10:34 AM

It works for sub-folders on my current domain.
The new domain, however, still spits this:

Application error
Rails application failed to start properly

2007-01-06 12:40 PM

Hi there,
99% of these kind of troubles can be solved by the info in these two threads: http://www.hostingrails.com/forums/wiki_thread/15http://www.hostingrails.com/forums/wiki_thread/9

Let me know if that helps,

~William

2007-01-07 12:56 AM


Hello Guest! In order to post you must be an active client with us, please log in or sign up.



Previous URLs for this page here and here