Results 1 to 13 of 13
  1. #1

    .htaccess guru needed :)

    Hi!,

    I've installed silverstripe CMS on my main domain. It comes with a .htaccess file with the following in it:

    ### SILVERSTRIPE START ###
    <IfModule mod_dir.c>
    DirectorySlash Off
    </IfModule>

    RewriteEngine On
    RewriteBase /

    RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$

    RewriteCond %{REQUEST_URI} ^(.*)$
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]

    ### SILVERSTRIPE END ###

    This configuration stops access to other folders on the domain such as my support system.

    www.mydomain.com/support, currently forwards to silverstripes 404 error page.

    Does anyone know how to modify the .htacces to allow me to access my support directory? I got close to it, but got a 500 error...

  2. #2
    Join Date
    Oct 2004
    Location
    Kerala, India
    Posts
    4,771
    If you put the trailing slash is it working?

    http://domain.com/support/
    David | www.cliffsupport.com
    Affordable Server Management Solutions sales AT cliffsupport DOT com
    CliffWebManager | Access WHM from iPhone and Android

  3. #3

  4. #4
    The quickest way to fix this is create a new blank .htaccess file, and put

    RewriteEngine Off

    Then place this file in each directory you want not to forward to your CMS 404.

  5. #5
    Join Date
    Jun 2003
    Posts
    367
    Try this:

    Code:
    ### SILVERSTRIPE START ###
    <IfModule mod_dir.c>
    DirectorySlash Off
    </IfModule>
    
    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$
    RewriteCond %{REQUEST_URI} !^/support
    
    RewriteCond %{REQUEST_URI} ^(.*)$
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
    
    ### SILVERSTRIPE END ###
    Common sense is not so common.

  6. #6
    Quote Originally Posted by Xous View Post
    Try this:

    Code:
    ### SILVERSTRIPE START ###
    <IfModule mod_dir.c>
    DirectorySlash Off
    </IfModule>
    
    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$
    RewriteCond %{REQUEST_URI} !^/support
    
    RewriteCond %{REQUEST_URI} ^(.*)$
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
    
    ### SILVERSTRIPE END ###
    YES!!!!

    Next problem! The subdomain for the support system doesn't work...

    http://support.dediserversdirect.com

  7. #7
    Hi,

    I'm now using

    Code:
    ### SILVERSTRIPE START ###
    <IfModule mod_dir.c>
    DirectorySlash Off
    </IfModule>
    
    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$
    RewriteCond %{HTTP_HOST} ^support.dediserversdirect.com$
    RewriteCond %{REQUEST_URI} !^/support
    RewriteRule ^(.*)$ support/$1 [L]
    
    RewriteCond %{REQUEST_URI} ^(.*)$
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
    
    ### SILVERSTRIPE END ###
    And I get the subdomain loading but I get the dreaded 500 internal error. Any ideas?

  8. #8
    Join Date
    Dec 2007
    Location
    IN
    Posts
    146
    Have you tried placing a blank .htaccess on the folder?
    Inway - India's Most Trusted Web Host
    █ SSD Web Hosting + CMS + Email Solutions Simplified
    Visit us at Web Hosting India

  9. #9
    Join Date
    Oct 2008
    Location
    Ohio
    Posts
    41
    Have you tried escaping the dots in this line:

    RewriteCond %{HTTP_HOST} ^support.dediserversdirect.com$

    change to:

    RewriteCond %{HTTP_HOST} ^support\.dediserversdirect\.com$

  10. #10
    Quote Originally Posted by jem3 View Post
    Have you tried escaping the dots in this line:

    RewriteCond %{HTTP_HOST} ^support.dediserversdirect.com$

    change to:

    RewriteCond %{HTTP_HOST} ^support\.dediserversdirect\.com$

    Nope, still the same

    @ Inway - Yes i've tried this.

  11. #11
    Join Date
    Oct 2008
    Location
    Ohio
    Posts
    41
    Do you have access to your server's apache error log; it will tell you exactly which part of the .htaccess file that is erroring. For instance, on my system, where mod_dir is not installed, the error log says this:

    [Tue Oct 7 19:21:58 2008] [alert] [client 71.61.41.75] /home/jemjem/jem-www/.htaccess: Invalid command 'DirectorySlash', perhaps mis-spelled or defined by a module not included in the server configuration

  12. #12
    Join Date
    Oct 2008
    Location
    Ohio
    Posts
    41
    Once you get your particular internal server error worked out, the following will redirect your subdomain to the support directory; if the index page is not where you have them starting, then just substitute index.html for your start page within the support directory.

    RewriteCond %{HTTP_HOST} ^support\.dediserversdirect\.com
    RewriteRule .* support/index.html [L]

  13. #13
    Join Date
    Jun 2003
    Posts
    367
    Hi,

    Shouldn't you have the sub-domain condition negated? i.e. you don't want the rewrite to happen on the sub-domain.
    Code:
    ### SILVERSTRIPE START ###
    <IfModule mod_dir.c>
    DirectorySlash Off
    </IfModule>
    
    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$
    RewriteCond %{HTTP_HOST} !^support\.dediserversdirect\.com$
    RewriteCond %{REQUEST_URI} !^/support
    RewriteRule ^(.*)$ support/$1 [L]
    
    RewriteCond %{REQUEST_URI} ^(.*)$
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
    
    ### SILVERSTRIPE END ###
    As for the 500 error it is best to consult the apache error_log for the vhost.

    A bad .htaccess file can cause a 500 error.
    Common sense is not so common.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •