Page 1 of 1

DISCUSSION: Guide to .htaccess

Posted: Tue Jul 25, 2006 9:44 am
by yana
EDIT: MOD NOTE
This is the discussion for the topic located here: Discuss topic located here: http://forum.joomla.org/index.php/topic,79277.0.html


I would like to know how I can use .htaccess to show my domain name only with WWW.
The hoster use domain names without WWW by default and I have a problem with Java Script sometimes...

Re: DISCUSSION: Guide to .htaccess

Posted: Mon Jul 31, 2006 4:05 pm
by emagin
Just a quick note on register_globals=OFF

In several hosted environments I have found they run PHP in CGI mode, which means you cannot set any traditional php.ini parameters from .htaccess.  It craps out.

Here is a thread where I explain how to do this in hosted php/cgi mode environments:
http://forum.joomla.org/index.php/topic ... #msg394932

Re: DISCUSSION: Guide to .htaccess

Posted: Tue Aug 01, 2006 1:31 pm
by Elpie
emagin wrote: Just a quick note on register_globals=OFF

In several hosted environments I have found they run PHP in CGI mode, which means you cannot set any traditional php.ini parameters from .htaccess.  It craps out.
Yes. I made that point with this:
Now, here is the tricky part. These directives ONLY work on sites that have PHP running under Apache, as an Apache module, not as CGI. PHPSuExec runs under CGI and setting the register_globals in .htaccess will not work.
With PHP running under cgi, some hosts allow users to set individual php.ini files, some don't. And, again, what is permitted within those files depends very much on how the host has set the server up. 

Windows users running Apache on IIS also have the same problem - it all depends on how the server is set up to handle overrides.

Re: DISCUSSION: Guide to .htaccess

Posted: Fri Aug 25, 2006 3:35 pm
by emagin
Sorry, hadn't seen that note in your post there, thanks!
Might be useful to put up some scenarios:

Apache 1.x
Apache 1.x with PHP in CGI mode
Apache 2.x

Etc. but maybe that just complicates things.
I just know that when I first started reading about all this stuff, I spent a couple of hours trying to figure out why I kept getting errors on editing .htaccess, and I had to search around about the CGI mode issues.


All the best.

Re: DISCUSSION: Guide to .htaccess

Posted: Mon Feb 19, 2007 4:31 am
by ez2ask
I am totally exhausted with the .htaccess file (Joomla core SEF), I tried everything I could and I read lots of related articles from Joomla Forum site, but NONE of them are worked. I do not know what's wrong with it, I hope someone could help me ASAP if possible. Really appreciate!! :)

I have already wrote a test .htaccess file (according to JoomProsolution.com's testing .htaccess file), and it works. That means mod_rewrite is enable. I have already asked the hosting company, they said the .htaccess override is enable also. The hosting server environment is Apache 1.3.33 (Unix) and PHP 4.4.4, the PHP register_globals is currently on.

The .htaccess file that I tried is following: (Joomla was installed under root directory and domain is like http://www.mydomain.org)

##  Can be commented out if causes errors, see notes above.
Options +FollowSymLinks #I tried commented, uncommented and also none + sign in frond of FollowSymLinks, none of them worked :'(

#
#  mod_rewrite in use

RewriteEngine On
php_flag register_globals off #Joomla suggests to turn it off, I also tried php_value register_globals 0, and does not work either

#  Uncomment following line if your webserver's URL
#  is not directly related to physical file paths.
#  Update Your Joomla/MamboDirectory (just / for root)

# RewriteBase /
RewriteCond %{HTTP_HOST} ^mydomain.org #with or without these two lines, are all causeed Internal Server Error message :'(
RewriteRule ^(.*)$ http://www.mydomain.org/$1 [R=301,L]

########## 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 - 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 tag in URL
RewriteCond %{QUERY_STRING} (\|%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

The error message I got is Internal Server Error. The hosting company said that they did not support script, they do not know anything about the .htaccess script. So, you are the only hope I have now. Please help!! If I missed any information for you to help me solve this problem, please let me know. Thank you so much. ;)

Urgent: Need Help for .htaccess

Posted: Tue Feb 20, 2007 2:37 am
by ez2ask
:'( :'( Anyone, please help me for the .htaccess issue that I post above. It's really urgent!! I really need your help!! Thanks!  :'( :'(