cancel
Showing results for 
Search instead for 
Did you mean: 

Joomla - renaming htaccess.txt to .htaccess

TLE
Grafter
Posts: 109
Registered: 01-12-2009

Joomla - renaming htaccess.txt to .htaccess

Hi,
I am really struggling with this due to my lack of understanding. I have a Joomla site and currently the file is named htaccess.txt and "Use Apache mod_rewrite" is set to No.
I changed the "Use Apache mod_rewrite" too Yes, and renamed htaccess.txt to .htaccess. This resulted in an Internal 500 error. I searched the forum but I can't make head nor tail of this file, I am not a web developer by trade, but I will need to look into this so that I understand more.
Here is the contents of htaccess.txt, does this need to be edited before making the changes? or should it just work?
Joomla is installed in the root and not in a foler called Joomla. So the home page is located at ccgi.username.plus.com

##
# @version $Id: htaccess.txt 14401 2010-01-26 14:10:00Z louis $
# @package Joomla
# @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
# @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
# Joomla! is Free Software
##

#####################################################
#  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.
#
#####################################################
##  Can be commented out if causes errors, see notes above.
Options +FollowSymLinks
#
#  mod_rewrite in use
RewriteEngine On
########## 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!
#
## Deny access to extension xml files (uncomment out to activate)
#<Files ~ "\.xml$">
#Order allow,deny
#Deny from all
#Satisfy all
#</Files>
## End of deny access to extension xml files
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
#  Uncomment following line if your webserver's URL
#  is not directly related to physical file paths.
#  Update Your Joomla! Directory (just / for root)
# RewriteBase /

########## Begin - Joomla! core SEF Section
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$  [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#
########## End - Joomla! core SEF Section

Any help would be appreciated.
Thanks
TLE
10 REPLIES
Superuser
Superuser
Posts: 6,474
Thanks: 590
Fixes: 49
Registered: 30-07-2007

Re: Joomla - renaming htaccess.txt to .htaccess

I think you might find this http://usertools.plus.net/tutorials/?id=5 useful , and particulary the link in there to the cgi upgrade faq.
TLE
Grafter
Posts: 109
Registered: 01-12-2009

Re: Joomla - renaming htaccess.txt to .htaccess

Thanks MisterW, I think all that information may take a while to sink in, although after a quick read through would I be right in thinking that I need to unhash "# RewriteBase /".
Since Joomla is installed in the root, I don't need to change the following line to incude the username.
RewriteCond %{REQUEST_URI} !^/index.php
Thanks
TLE
Superuser
Superuser
Posts: 6,474
Thanks: 590
Fixes: 49
Registered: 30-07-2007

Re: Joomla - renaming htaccess.txt to .htaccess

Quote
although after a quick read through would I be right in thinking that I need to unhash "# RewriteBase /".

I'm really not sure, I'm no expert in this, I've only recently started playing with cgi myself, I just happened to know where the guide on .htaccess was because I was reading it myself very recently.
Hopefully a real 'expert' will come along and answer your query.
TLE
Grafter
Posts: 109
Registered: 01-12-2009

Re: Joomla - renaming htaccess.txt to .htaccess

Lets hope so becuase  I am getting no where fast  Smiley
TLE
Grafter
Posts: 109
Registered: 01-12-2009

Re: Joomla - renaming htaccess.txt to .htaccess

Great I have it working now  Smiley
Does anyone know  how I can turn off Global variables now?
Thanks
TLE
Community Veteran
Posts: 767
Registered: 29-10-2008

Re: Joomla - renaming htaccess.txt to .htaccess

Hi TLE,
You can use a custom php.ini file, as in section 12 of the faq and link. I think, according to the original schedule (section 4 of the faq), register_globals should be set off in a few days any way, but we haven't had a reminder so that might have slipped.
Gabe
TLE
Grafter
Posts: 109
Registered: 01-12-2009

Re: Joomla - renaming htaccess.txt to .htaccess

Hi Gabe,
I came accross your original post about the php.ini files last night at about 1.00am so I didn't have time to post back here to say I had manged to turn them off. I appreciate you replying though  Smiley
Yes I though Plusnet were due to turn them off 3 months or so after the upgrade.
Again, thanks for your help.
TLE.
TLE
Grafter
Posts: 109
Registered: 01-12-2009

Re: Joomla - renaming htaccess.txt to .htaccess

I have one further complication now. Since updating the website I have now started getting 404 errors when google is crawling the site using the various links. The guys on the google forum have suggested I add a 303 redirect to push http://www.thirsk-homeitsolutions.co.uk/index.htm to http://www.thirsk-homeitsolutions.co.uk/.
Is this correct for a 301 redirect or is there a better way of doing it?
redirect 301 /index.htm http://www.thirsk-homeitsolutions.co.uk
Also where abouts does this need to be placed in the .htaccess files.
Thanks for any help.
##
# @version $Id: htaccess.txt 14401 2010-01-26 14:10:00Z louis $
# @package Joomla
# @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
# @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
# Joomla! is Free Software
##

#####################################################
#  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.
#
#####################################################
##  Can be commented out if causes errors, see notes above.
#Options +FollowSymLinks
#
#  mod_rewrite in use
RewriteEngine On
########## 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!
#
## Deny access to extension xml files (uncomment out to activate)
#<Files ~ "\.xml$">
#Order allow,deny
#Deny from all
#Satisfy all
#</Files>
## End of deny access to extension xml files
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
#  Uncomment following line if your webserver's URL
#  is not directly related to physical file paths.
#  Update Your Joomla! Directory (just / for root)
RewriteBase /

########## Begin - Joomla! core SEF Section
#
RewriteCond %{HTTP_HOST} ^thirsk-homeitsolutions.co.uk
RewriteRule (.*) http://www.thirsk-homeitsolutions.co.uk/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.png|\.gif|\.jpg|\.pdf|\.raw|/[^.]*)$  [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#
########## End - Joomla! core SEF Section
TLE
Grafter
Posts: 109
Registered: 01-12-2009

Re: Joomla - renaming htaccess.txt to .htaccess

Can anyone offer any advice as the above does not have any effect.
Thanks
TLE
Community Veteran
Posts: 767
Registered: 29-10-2008

Re: Joomla - renaming htaccess.txt to .htaccess

No, that won't work. Try something like
RewriteRule ^index.htm$ / [R=301,L]

added just before the sef section.
Could also submit a sitemap file to google and reference that from robots.txt.
Gabe