[support] htaccess for a non Drupal folder

Marolijo marolijo at yahoo.es
Tue Nov 9 11:43:57 UTC 2010


Thank's I tried this without luck....

my non-drupal folder is /smf

I added this to my .htaccess

  RewriteCond %{REQUEST_URI} !^/smf
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

The .htaccess content is:



#
# Apache/PHP/Drupal settings:
#

# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl|svn-base)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template|all-wcprops|entries|format)$">
  Order allow,deny
</FilesMatch>

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Follow symbolic links in this directory.
Options +FollowSymLinks

# Make Drupal handle any 404 errors.
ErrorDocument 404 /index.php

# Force simple error message for requests for non-existent favicon.ico.
<Files favicon.ico>
  # There is no end quote below, for compatibility with Apache 1.3.
  ErrorDocument 404 "The requested file favicon.ico was not found.
</Files>

# Set the default handler.
DirectoryIndex index.php

# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.

# PHP 4, Apache 1.
<IfModule mod_php4.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# PHP 4, Apache 2.
<IfModule sapi_apache2.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
  # Enable expirations.
  ExpiresActive On

  # Cache all files for 2 weeks after access (A).
  ExpiresDefault A1209600

  <FilesMatch \.php$>
    ExpiresActive Off
  </FilesMatch>
</IfModule>

# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on

  # Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]


  RewriteCond %{REQUEST_URI} !^/smf
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

</IfModule>







Any idea? thank's!




2010/11/9 Dipen <dipench at gmail.com>:
> You should rather use the <FilesMatch> directive to exclude the files or
> directories from being served. This would mean that apache will deny any
> request for those files that match, in addition to that you can also use the
> <Directory> directive to disallow the complete folder in your Vhost config.
> The latter method would definitely mean that your apache cant serve the smf
> forum software.
> HTH
>
>
> On Tue, Nov 9, 2010 at 3:25 PM, Marolijo <marolijo at yahoo.es> wrote:
>>
>> Hello, I have a SMF Forum on the /smf folder
>> I need to tell .htaccess no to grab all the urls under /smf,
>>
>> I tried this without luck, any idea?
>>
>> <IfModule mod_rewrite.c>
>> RewriteEngine on
>> # A trailing / is added to directory requests by the http.conf or
>> somewhere.
>> # Exclude the smf directory.
>> #RewriteCond %{REQUEST_FILENAME} !^smf.*
>> # Rewrite only if the file is not found.
>> RewriteCond %{REQUEST_FILENAME} !-f
>> # Rewrite only if the directory is not found.
>> RewriteCond %{REQUEST_FILENAME} !-d
>> # Rewrite a URL to make the request a query parameter of
>> q=original_request.
>> RewriteRule ^(.*)$ index.html?q=$1 [L,QSA]
>>
>>
>> Thank's!
>> --
>> [ Drupal support list | http://lists.drupal.org/ ]
>
>
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>


More information about the support mailing list