[UTILIZED FOR 1.0.8] new .htaccess gives proper 404s

For Joomla! 1.0 Coding related discussions.
motin
Joomla! Apprentice
Joomla! Apprentice
Posts: 16
Joined: Wed Feb 01, 2006 5:47 am
Contact:

Re: new .htaccess gives proper 404s

Post by motin » Sun May 21, 2006 2:29 am

Goosemoose wrote: I dont' know if this helps at all, but just in case.

The reason xtdratings & facileforms stopped working is because of these lines in sef.php, once commented out everything started working again. Any ideas on why?

Code: Select all

// if ($juri != "" && !eregi( "index.php", $_SERVER['REQUEST_URI'] ) && !eregi( "index2.php", $_SERVER['REQUEST_URI'] ) && !eregi( "/?", $_SERVER['REQUEST_URI'] ) ) {
 header( 'HTTP/1.0 404 Not Found' );
 require_once( $mosConfig_absolute_path . '/templates/404.php' );
 exit( 404 );
}
That code effectively prevents any attempts to use querystrings (or simply REQUEST_URI's with questionmarks in it) on scripts other than index.php and index2.php while in SEF mode, which is great for security reasons.

But... since we want to run the facile forms script with querystring data as well, we need to add a:

Code: Select all

 && !eregi( "components\/com_facileforms\/facileforms\.frame\.php", $_SERVER['REQUEST_URI'] ) 


to the conditions, like this:

Code: Select all

		if ($juri != "" && !eregi( "index\.php", $_SERVER['REQUEST_URI'] ) && !eregi( "index2\.php", $_SERVER['REQUEST_URI'] ) && !eregi( "components\/com_facileforms\/facileforms\.frame\.php", $_SERVER['REQUEST_URI'] ) && !eregi( "/\?", $_SERVER['REQUEST_URI'] ) ) {
			header( 'HTTP/1.0 404 Not Found' );
			require_once( $mosConfig_absolute_path . '/templates/404.php' );
			exit( 404 );
		}
And facile forms should work even in SEF-mode.

Check it out working fine at http://www.motin.eu/Contact-Me.html

viking2ev
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Fri Dec 14, 2007 9:14 am

Re: [UTILIZED FOR 1.0.8] new .htaccess gives proper 404s

Post by viking2ev » Fri Dec 14, 2007 9:24 am

Hi,
Sorry for being a novice at this, but I do not understand how to fix my .htaccess file.

When I try to create a password protected directory on our website, I get a "File not Found Error". From what I understand this is due to a problem in the joomla .htaccess file?

Note that I am running an old version of Joomla (possibly v1.0.13) and I can currently not upgrade.

How would I rewrite the current file (see code below) to be able to use password protected directories?

TIA!!

Code: Select all


#
# Apache/PHP/Drupal settings:
#

# Protect files and directories from prying eyes.
<Files ~ "(\.(inc|module|pl|sh|sql|theme|engine|xtmpl)|Entries|Repositories|Root|scripts|updates)$">
  Order deny,allow
  Deny from all
</Files>

# Set some options.
Options +ExecCGI -Indexes
Options +ExecCGI +FollowSymLinks

# Customized error messages.
ErrorDocument 404 /index.php

# Set the default handler.
DirectoryIndex index.php

# Override PHP settings. More exist in sites/default/settings.php, but
# the following cannot be changed at runtime. The first IfModule is
# for Apache 1.3, the second for Apache 2.
<IfModule mod_php4.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
</IfModule>

<IfModule sapi_apache2.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
</IfModule>

# Reduce the time dynamically generated pages are cache-able.
<IfModule mod_expires.c>
  ExpiresByType text/html A1
</IfModule>

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

  # Modify the RewriteBase if you are using Drupal in a subdirectory and
  # the rewrite rules are not working properly.
  #RewriteBase /drupal

  # Rewrite old-style URLs of the form 'node.php?id=x'.
  #RewriteCond %{REQUEST_FILENAME} !-f
  #RewriteCond %{REQUEST_FILENAME} !-d
  #RewriteCond %{QUERY_STRING} ^id=([^&]+)$
  #RewriteRule node.php index.php?q=node/view/%1 [L]

  # Rewrite old-style URLs of the form 'module.php?mod=x'.
  #RewriteCond %{REQUEST_FILENAME} !-f
  #RewriteCond %{REQUEST_FILENAME} !-d
  #RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
  #RewriteRule module.php index.php?q=%1 [L]

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

# $Id: .htaccess,v 1.66 2005/03/20 19:15:00 dries Exp $
Last edited by viking2ev on Fri Dec 14, 2007 10:37 am, edited 1 time in total.

abdu
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Wed Dec 09, 2009 8:53 am

Re: [UTILIZED FOR 1.0.8] new .htaccess gives proper 404s

Post by abdu » Thu Dec 10, 2009 9:16 am

i don't understand


Locked

Return to “Joomla! 1.0 Coding”