can't make work joomla + sef + .htaccess

Discussion in 'General' started by bochenn, Mar 30, 2007.

  1. bochenn

    bochenn New Member

  2. AlArenal

    AlArenal New Member

    Check Apache's error log on whether or not your .htaccess file gets processed. Did you add something like the following to your web's Apache directives in ISPConfig?

    Code:
    <Directory /var/www/web123/web>
      Options FollowSymLinks
      AllowOverride All
    </Directory>
     
  3. bochenn

    bochenn New Member

    i have added those lines to my apache directives but with no success.

    This is my error log.

    Code:
    Mar 29 18:17:43 2007] [alert] [client 201.231.24.149] /var/www/web123/web/.htaccess: Options not allowed here
    Mar 29 18:17:45 2007] [alert] [client 201.231.24.149] /var/www/web123/web/.htaccess: Options not allowed here
    Mar 29 18:17:45 2007] [alert] [client 201.231.24.149] /var/www/web123/web/.htaccess: Options not allowed here
    Mar 29 18:17:46 2007] [alert] [client 201.231.24.149] /var/www/web123/web/.htaccess: Options not allowed here
    Mar 29 18:17:46 2007] [alert] [client 201.231.24.149] /var/www/web123/web/.htaccess: Options not allowed here
    Mar 29 18:18:30 2007] [error] [client 201.231.24.149] PHP Notice:  Constant _VALID_MOS already defined in /var/www/web123/web/mambots/system/bot_sifr.php on line 13
    Mar 29 18:18:30 2007] [error] [client 201.231.24.149] PHP Notice:  Undefined variable: task in /var/www/web123/web/components/com_sef/sef404.php on line 693
    Mar 29 18:18:30 2007] [error] [client 201.231.24.149] PHP Notice:  Undefined index:  HTTPS in /var/www/web123/web/modules/mod_user_tracking_stats.php on line 38
    Mar 29 18:19:04 2007] [error] [client 201.231.24.149] File does not exist: /var/www/web123/web/consultorio, referer: http://www.guillermo.com/
    Mar 29 18:19:06 2007] [error] [client 201.231.24.149] PHP Notice:  Constant _VALID_MOS already defined in /var/www/web123/web/mambots/system/bot_sifr.php on line 13
    Mar 29 18:19:06 2007] [error] [client 201.231.24.149] PHP Notice:  Undefined variable: task in /var/www/web123/web/components/com_sef/sef404.php on line 693
    Mar 29 18:19:06 2007] [error] [client 201.231.24.149] PHP Notice:  Undefined index:  HTTPS in /var/www/web123/web/modules/mod_user_tracking_stats.php on line 38
    Mar 29 18:20:20 2007] [error] [client 201.231.24.149] PHP Notice:  Constant _VALID_MOS already defined in /var/www/web123/web/mambots/system/bot_sifr.php on line 13
    Mar 29 18:20:20 2007] [error] [client 201.231.24.149] PHP Notice:  Undefined variable: task in /var/www/web123/web/components/com_sef/sef404.php on line 693
    Mar 29 18:20:20 2007] [error] [client 201.231.24.149] PHP Notice:  Undefined index:  HTTPS in /var/www/web123/web/modules/mod_user_tracking_stats.php on line 38
    Mar 29 18:42:45 2007] [error] [client 201.231.24.149] PHP Fatal error:  Allowed memory size of 8388608 bytes exhausted (tried to allocate 45 bytes) in /var/www/web123/web/i
    Mar 29 18:43:30 2007] [error] [client 201.231.24.149] PHP Notice:  Constant _VALID_MOS already defined in /var/www/web123/web/mambots/system/bot_sifr.php on line 13, refere
    Mar 29 18:43:30 2007] [error] [client 201.231.24.149] PHP Notice:  Undefined variable: task in /var/www/web123/web/components/com_sef/sef404.php on line 693, referer: http:
    Mar 29 18:43:30 2007] [error] [client 201.231.24.149] PHP Notice:  Undefined index:  HTTPS in /var/www/web123/web/modules/mod_user_tracking_stats.php on line 38, referer: h
    Mar 29 18:55:17 2007] [error] [client 66.249.65.143] File does not exist: /var/www/web123/web/pasantias.html
    Mar 29 18:55:17 2007] [error] [client 66.249.65.143] File does not exist: /var/www/web123/web/actividades-cientificas
    Mar 29 18:55:18 2007] [error] [client 66.249.65.143] File does not exist: /var/www/web123/web/actividades-cientificas
    Mar 29 19:24:21 2007] [error] [client 66.249.65.143] File does not exist: /var/www/web123/web/curriculum-vitae-dr.-guillermo-.html
    Mar 29 19:24:21 2007] [error] [client 66.249.65.143] File does not exist: /var/www/web123/web/consultorio
    Mar 29 22:43:29 2007] [error] [client 125.60.243.43] PHP Notice:  Constant _VALID_MOS already defined in /var/www/web123/web/mambots/system/bot_sifr.php on line 13, referer
    Mar 29 22:43:32 2007] [error] [client 125.60.243.43] PHP Notice:  Undefined variable: task in /var/www/web123/web/components/com_sef/sef404.php on line 693, referer: http:/
    Mar 29 22:43:32 2007] [error] [client 125.60.243.43] PHP Notice:  Undefined variable: htmlClass in /var/www/web123/web/modules/mod_sm2sectionHeader.php on line 31, referer:
    Mar 29 22:43:32 2007] [error] [client 125.60.243.43] PHP Notice:  Undefined property:  stdClass::$title in /var/www/web123/web/modules/mod_js_smoothgallery.php on line 11, 
    Mar 29 22:43:32 2007] [error] [client 125.60.243.43] PHP Notice:  Undefined index:  HTTPS in /var/www/web123/web/modules/mod_user_tracking_stats.php on line 38, referer: ht
    Mar 30 00:39:55 2007] [error] [client 74.6.73.251] File does not exist: /var/www/web123/web/actividades-cientificas
    Mar 30 04:05:09 2007] [error] [client 201.231.24.149] PHP Notice:  Constant _VALID_MOS already defined in /var/www/web123/web/mambots/system/bot_sifr.php on line 13
    Mar 30 04:05:10 2007] [error] [client 201.231.24.149] PHP Notice:  Undefined variable: task in /var/www/web123/web/components/com_sef/sef404.php on line 693
    Mar 30 04:05:10 2007] [error] [client 201.231.24.149] PHP Notice:  Undefined index:  HTTPS in /var/www/web123/web/modules/mod_user_tracking_stats.php on line 38
    Mar 30 04:06:25 2007] [error] [client 201.231.24.149] File does not exist: /var/www/web123/web/favicon.ico
    Mar 30 04:12:29 2007] [error] [client 201.231.24.149] PHP Fatal error:  Allowed memory size of 8388608 bytes exhausted (tried to allocate 32 bytes) in /var/www/web123/web/i
    Mar 30 04:21:30 2007] [error] [client 201.231.24.149] PHP Fatal error:  Allowed memory size of 8388608 bytes exhausted (tried to allocate 41 bytes) in /var/www/web123/web/i
    Mar 30 04:36:09 2007] [error] [client 201.231.24.149] File does not exist: /var/www/web123/web/favicon.ico
    Mar 30 04:57:52 2007] [error] [client 201.231.24.149] PHP Fatal error:  Allowed memory size of 8388608 bytes exhausted (tried to allocate 6 bytes) in /var/www/web123/web/in
    Mar 30 04:59:29 2007] [error] [client 201.231.24.149] PHP Fatal error:  Allowed memory size of 8388608 bytes exhausted (tried to allocate 49 bytes) in /var/www/web123/web/i
    Mar 30 04:59:52 2007] [error] [client 201.231.24.149] PHP Fatal error:  Allowed memory size of 8388608 bytes exhausted (tried to allocate 49 bytes) in /var/www/web123/web/i
    Mar 30 06:47:00 2007] [error] [client 201.231.24.149] PHP Notice:  Constant _VALID_MOS already defined in /var/www/web123/web/mambots/system/bot_sifr.php on line 13, refere
    Mar 30 06:47:00 2007] [error] [client 201.231.24.149] PHP Notice:  Undefined variable: task in /var/www/web123/web/components/com_sef/sef404.php on line 693, referer: http:
    Mar 30 06:47:00 2007] [error] [client 201.231.24.149] PHP Notice:  Undefined index:  HTTPS in /var/www/web123/web/modules/mod_user_tracking_stats.php on line 38, referer: h
    Mar 30 06:47:06 2007] [error] [client 201.231.24.149] File does not exist: /var/www/web123/web/nosotros.html, referer: http://www.guillermo.com/index.php
    Mar 30 06:47:14 2007] [error] [client 201.231.24.149] File does not exist: /var/www/web123/web/nosotros.html, referer: http://www.guillermo.com/index.php
    Mar 30 06:47:16 2007] [error] [client 201.231.24.149] File does not exist: /var/www/web123/web/nosotros.html, referer: http://www.guillermo.com/index.php
    Mar 30 06:47:21 2007] [error] [client 201.231.24.149] PHP Notice:  Undefined property:  mosConfig::$config_ml_support in /var/www/web123/web/administrator/components/com_co
    Mar 30 06:48:34 2007] [error] [client 201.231.24.149] PHP Notice:  Constant _VALID_MOS already defined in /var/www/web123/web/mambots/system/bot_sifr.php on line 13, refere
    Mar 30 06:48:34 2007] [error] [client 201.231.24.149] PHP Notice:  Undefined variable: task in /var/www/web123/web/components/com_sef/sef404.php on line 693, referer: http:
    Mar 30 06:48:34 2007] [error] [client 201.231.24.149] PHP Notice:  Undefined index:  HTTPS in /var/www/web123/web/modules/mod_user_tracking_stats.php on line 38, referer: h
    Mar 30 06:49:36 2007] [error] [client 201.231.24.149] File does not exist: /var/www/web123/web/actividades-cientificas, referer: http://www.guillermo.com/index.php 
    Mar 30 06:49:38 2007] [error] [client 201.231.24.149] File does not exist: /var/www/web123/web/actividades-cientificas, referer: http://www.guillermo.com/index.php 
    Mar 30 06:49:39 2007] [error] [client 201.231.24.149] File does not exist: /var/www/web123/web/actividades-cientificas, referer: http://www.guillermo.com/index.php
    
     
  4. AlArenal

    AlArenal New Member

    Um.. it would take a great coincidence for my code to work on your machine, as "web123" has to substituted by the directory name of the web for which you want to pull the trigger. Maybe I dhould have made it clearer...

    So instead of "web123" have a look at how the directory is named on your machine. You may be able to even use the link "www.yourdomain.tld" pointing to the web's directory. "ls -l /var/www" should provide you with more information (although I'm not sure the path is the same on other distributions as I am using Debian Etch).
     
  5. bochenn

    bochenn New Member

    the directory name is web123, the same as in your example.
     
  6. AlArenal

    AlArenal New Member

    Serious!?

    I should have played lotto then...

    To me you error messages says something like "whatever you are trying to do in .htaccess, the web server is not configured to allow the included actions".

    Did you create the directory web123 by hand? I still doubt my luck...
     
  7. bochenn

    bochenn New Member

    i create the directories via ispconfig, and that domain has the name web123, /var/www/web123/web

    i don't know where else to look.
    thanks
    cheers
     
  8. falko

    falko Super Moderator

    At the end of your main Apache configuration file you'll find something like this:

    Code:
    <Directory /var/www/*/web>
        Options +Includes -Indexes
        AllowOverride None
        AllowOverride Indexes AuthConfig Limit FileInfo Options
        Order allow,deny
        Allow from all
        <Files ~ "^\.ht">
        Deny from all
        </Files>
    </Directory>
    Change it to

    Code:
    <Directory /var/www/*/web>
        Options +Includes -Indexes
        [B][COLOR="Red"]AllowOverride All[/COLOR][/B]
        Order allow,deny
        Allow from all
        <Files ~ "^\.ht">
        Deny from all
        </Files>
    </Directory>
    and restart Apache.
     
  9. bochenn

    bochenn New Member

    this is how my coder came to the solution, check the lines uncommented and bolder
    do you think it is a valid solution?


    AFTER

    Code:
    ##
    # @version $Id: htaccess.txt 5973 2006-12-11 01:26:33Z robs $
    # @package Joomla
    
    #####################################################
    #  READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE
    #
    # The line just below this section: 'Options +FollowSymLinks' may cause problems
    # with some server configurations.  It is required for use of mod_rewrite, but may already
    # be set by your server administrator in a way that dissallows changing it in
    # your .htaccess file.  If using it causes your server to error out, comment it out (add # to
    # beginning of line), reload your site in your browser and test your sef url's.  If they work,
    # it has been set by your server administrator and you do not need it set here.
    #
    # Only use one of the two SEF sections that follow.  Lines that can be uncommented
    # (and thus used) have only one #.  Lines with two #'s should not be uncommented
    # In the section that you don't use, all lines should start with #
    #
    # For Standard SEF, use the standard SEF section.  You can comment out
    # all of the RewriteCond lines and reduce your server's load if you
    # don't have directories in your root named 'component' or 'content'
    #
    # If you are using a 3rd Party SEF or the Core SEF solution
    # uncomment all of the lines in the '3rd Party or Core SEF' section
    #
    #####################################################
    
    #####  SOLVING PROBLEMS WITH COMPONENT URL's that don't work #####
    # SPECIAL NOTE FOR SMF USERS WHEN SMF IS INTEGRATED AND BRIDGED
    # OR ANY SITUATION WHERE A COMPONENT's URL's AREN't WORKING
    #
    # In both the 'Standard SEF', and '3rd Party or Core SEF' sections the line:
    # RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR] ##optional - see notes##
    # May need to be uncommented.  If you are running your Joomla!/Mambo from
    # a subdirectory the name of the subdirectory will need to be inserted into this
    # line.  For example, if your Joomla!/Mambo is in a subdirectory called '/test/',
    # change this:
    # RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR] ##optional - see notes##
    # to this:
    # RewriteCond %{REQUEST_URI} ^(/test/component/option,com) [NC,OR] ##optional - see notes##
    #
    #####################################################
    
    
    ##  Can be commented out if causes errors, see notes above.
    # Options +FollowSymLinks
    
    #
    #  mod_rewrite in use
    
    RewriteEngine On
    
    #  Uncomment following line if your webserver's URL
    #  is not directly related to physical file paths.
    #  Update Your Joomla!/MamboDirectory (just / for root)
    
    # RewriteBase /
    
    
    ########## Begin - Joomla! core SEF Section
    ############# Use this section if using ONLY Joomla! core SEF
    ## ALL (RewriteCond) lines in this section are only required if you actually
    ## have directories named 'content' or 'component' on your server
    ## If you do not have directories with these names, comment them out.
    #
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    #RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR] 		##optional - see notes##
    RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$  [NC]
    RewriteRule ^(content/|component/) index.php
    #
    ########## End - Joomla! core SEF Section
    
    
    
    ########## Begin - 3rd Party SEF Section
    ############# Use this section if you are using a 3rd party (Non Joomla! core) SEF extension - e.g. OpenSEF, 404_SEF, 404SEFx, SEF Advance, etc
    #
    #RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR] 		##optional - see notes##
    #RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$  [NC]
    #RewriteCond %{REQUEST_FILENAME} !-f
    #RewriteCond %{REQUEST_FILENAME} !-d
    [B]RewriteRule (.*) index.php[/B]
    #
    ########## End - 3rd Party SEF Section
    
    
    
    ########## Begin - Rewrite rules to block out some common exploits
    ## If you experience problems on your site block out the operations listed below
    ## This attempts to block the most common type of exploit `attempts` to Joomla!
    #
    # Block out any script trying to set a mosConfig value through the URL
    RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
    # Block out any script trying to base64_encode crap to send via URL
    RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
    # Block out any script that includes a <script> tag in URL
    RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
    # Block out any script trying to set a PHP GLOBALS variable via URL
    RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
    # Block out any script trying to modify a _REQUEST variable via URL
    RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
    # Send all blocked request to homepage with 403 Forbidden error!
    RewriteRule ^(.*)$ index.php [F,L]
    #
    ########## End - Rewrite rules to block out some common exploits


    BEFORE

    Code:
    ##
    # @version $Id: htaccess.txt 5973 2006-12-11 01:26:33Z robs $
    # @package Joomla
    
    #####################################################
    #  READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE
    #
    # The line just below this section: 'Options +FollowSymLinks' may cause problems
    # with some server configurations.  It is required for use of mod_rewrite, but may already
    # be set by your server administrator in a way that dissallows changing it in
    # your .htaccess file.  If using it causes your server to error out, comment it out (add # to
    # beginning of line), reload your site in your browser and test your sef url's.  If they work,
    # it has been set by your server administrator and you do not need it set here.
    #
    # Only use one of the two SEF sections that follow.  Lines that can be uncommented
    # (and thus used) have only one #.  Lines with two #'s should not be uncommented
    # In the section that you don't use, all lines should start with #
    #
    # For Standard SEF, use the standard SEF section.  You can comment out
    # all of the RewriteCond lines and reduce your server's load if you
    # don't have directories in your root named 'component' or 'content'
    #
    # If you are using a 3rd Party SEF or the Core SEF solution
    # uncomment all of the lines in the '3rd Party or Core SEF' section
    #
    #####################################################
    
    #####  SOLVING PROBLEMS WITH COMPONENT URL's that don't work #####
    # SPECIAL NOTE FOR SMF USERS WHEN SMF IS INTEGRATED AND BRIDGED
    # OR ANY SITUATION WHERE A COMPONENT's URL's AREN't WORKING
    #
    # In both the 'Standard SEF', and '3rd Party or Core SEF' sections the line:
    # RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR] ##optional - see notes##
    # May need to be uncommented.  If you are running your Joomla!/Mambo from
    # a subdirectory the name of the subdirectory will need to be inserted into this
    # line.  For example, if your Joomla!/Mambo is in a subdirectory called '/test/',
    # change this:
    # RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR] ##optional - see notes##
    # to this:
    # RewriteCond %{REQUEST_URI} ^(/test/component/option,com) [NC,OR] ##optional - see notes##
    #
    #####################################################
    
    
    ##  Can be commented out if causes errors, see notes above.
    # Options +FollowSymLinks
    
    #
    #  mod_rewrite in use
    
    RewriteEngine On
    
    
    #  Uncomment following line if your webserver's URL
    #  is not directly related to physical file paths.
    #  Update Your Joomla!/MamboDirectory (just / for root)
    
    # RewriteBase /
    
    
    ########## Begin - Joomla! core SEF Section
    ############# Use this section if using ONLY Joomla! core SEF
    ## ALL (RewriteCond) lines in this section are only required if you actually
    ## have directories named 'content' or 'component' on your server
    ## If you do not have directories with these names, comment them out.
    #
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    #RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR] 		##optional - see notes##
    RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$  [NC]
    RewriteRule ^(content/|component/) index.php
    #
    ########## End - Joomla! core SEF Section
    
    
    
    ########## Begin - 3rd Party SEF Section
    ############# Use this section if you are using a 3rd party (Non Joomla! core) SEF extension - e.g. OpenSEF, 404_SEF, 404SEFx, SEF Advance, etc
    #
    #RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR] 		##optional - see notes##
    #RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$  [NC]
    #RewriteCond %{REQUEST_FILENAME} !-f
    #RewriteCond %{REQUEST_FILENAME} !-d
    #RewriteRule (.*) index.php
    #
    ########## End - 3rd Party SEF Section
    
    
    
    ########## Begin - Rewrite rules to block out some common exploits
    ## If you experience problems on your site block out the operations listed below
    ## This attempts to block the most common type of exploit `attempts` to Joomla!
    #
    # Block out any script trying to set a mosConfig value through the URL
    RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
    # Block out any script trying to base64_encode crap to send via URL
    RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
    # Block out any script that includes a <script> tag in URL
    RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
    # Block out any script trying to set a PHP GLOBALS variable via URL
    RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
    # Block out any script trying to modify a _REQUEST variable via URL
    RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
    # Send all blocked request to homepage with 403 Forbidden error!
    RewriteRule ^(.*)$ index.php [F,L]
    #
    ########## End - Rewrite rules to block out some common exploits
    NOTE: i cuted some lines from the headers of the htaccess files because of a warning of this board about the amont of chars.
     
    Last edited: Apr 3, 2007
  10. falko

    falko Super Moderator

    If it's working and there are no errors in your logs, it's fine, I'd say. :)
     

Share This Page