SEF & .htaccess - How I got mine to work on a hosted server

Moderator: mcsmom

Post Reply
Aquabri
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Mon Feb 20, 2006 10:30 pm

SEF & .htaccess - How I got mine to work on a hosted server

Post by Aquabri » Sun Mar 26, 2006 9:41 pm

Having poored over this site for 2 days and trying multiple solutions of which NONE worked i was starting to pull my hair out i ket on getting 500 internal server errors again and again!!!

I found a solution to my problem 5 minutes ago, that as far as i know no one has posted on here before so I thought I'd share it.

My hosting company was pretty much refusing to AllowOverride All, this was the solution that every other post was saying i needed but when i spoke to the host company 1and1.co.uk, they just kept repeating themselves saying that i could do it all myself.

Another day of study and i found this on http://httpd.apache.org/docs/2.0/mod/co ... owoverride

[quote="apache"]
Example:

AllowOverride AuthConfig Indexes

In the example above all directives that are neither in the group AuthConfig nor Indexes cause an internal server error.[/quote]

It all made perfect sense! your host allows certain commands that let you do what you need. So all i needed to do was find the commands in the .htaccess file that it didn't like and # them (also called commenting i think)

My host documentation said this...
[QUOTE=1and1]

The following list is a selection of commands which can be used in a ".htaccess" file:

Command Description
ErrorDocument Define your own custome error pages
AddType Assign a MIME-Type to a file ending
RewriteEngine Activate mod_rewrite module
Allow/Deny Host or IP based access control
FilesMatch File based access control
AuthType Basic password check
Redirect Redirection to another page or site
Options (de)activate index, symbolic links, etc.[/QUOTE]

This meant that i had to get rid of various commands that i'd put in my .htaccess file while i tried to make it work...

I had to remove (ie #)
mod_rewrite in use
AllowOveride (which someone else had advised to put in)

Once i ensured that my list of commands matched what the host would let me do this left me with this whole file

[Quote=Bri's .htaccess]
##
# @version $Id: htaccess.txt 1570 2005-12-29 05:53:33Z eddieajau $
# @package Joomla
# @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
# @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
# Joomla! is Free Software
##

Options +FollowSymLinks

#
# mod_rewrite in use
#

RewriteEngine On

##
## NOTE!
## When using multiple Joomla sites or other web applications in sub-folders,
## you must explicitly turn the RewriteEngine off or use the settings
## recommended for the application
##

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

RewriteBase /

#
#  Rules
#

RewriteCond %{REQUEST_FILENAME} !\.(jpg|jpeg|gif|png|css|js|pl|txt)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php
[/Quote]

And hey presto i now have a basic SEF site  :) http://www.aquanauts.co.uk

now to try out SEF Advanced  ;)

Hope this helps someone

Bri


EDIT forgot to mention i had to change a bit in configuration.php in the root

$mosConfig_sef = '0';

had to be changed to

$mosConfig_sef = '1';

also the htaccess.txt file had to be saved in the root as .htaccess  ;D
Last edited by Aquabri on Sun Mar 26, 2006 9:45 pm, edited 1 time in total.

justsomeboy
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Mon Mar 06, 2006 12:37 am
Contact:

Re: SEF & .htaccess - How I got mine to work on a hosted server

Post by justsomeboy » Mon Mar 27, 2006 5:46 am

Well, that looks identical to the original htaccess.txt that Joomla is distributed with, except that Rewrite Base / is now uncommented.  Is the example you provided your exact .htaccess file? I would love to know, because I am having the same 500 errors that SOOO many others are getting.....

Aquabri
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Mon Feb 20, 2006 10:30 pm

Re: SEF & .htaccess - How I got mine to work on a hosted server

Post by Aquabri » Mon Mar 27, 2006 10:06 am

Unfortunately there is no one size fits all solution... i over complicated things just trying to get things right before finnally understanding what i was doing. I looked at the code and it all just looked like lines of unintelligable gibberish.

Those http.apache help files are what sorted it for me.

Your host has a httpd.conf file running on their server, in this file they'll set certain permission of what you are allowed to do.

Your .htaccess file sets up your own little bit of their server but you can only use commands they'll let you.

Most of you are going to have to spend a little bit of time thinking things through and really understanding the problem. As if you use a command that your host does not permit you'll get the 500 error.

Other solutions were saying use the command AllowOveride, this was what was ruining it for me and giving me the 500 error.

Each of your solutions will be slightly different, depending on how they've configured things. The minimum you need to achieve
is:
Options +follow...
Rewrite engine on
Then Setup your base correctly.

All those other commands you've been reading about set up your ability to change the above 3.

Remember if you use a command you're not allowed to you WILL get a 500 error.

If the simple solution doesn't work then either your base is wrong, or you don't have permission to change stuff like the rewrite engine so you'll go round in circles till you realise this and then persuade them to change your rights in their httpd file.

If allowoveride on works for you, your host has given you alot of rights... i can't see most hosts allowing this.

Bri
Last edited by Aquabri on Mon Mar 27, 2006 10:08 am, edited 1 time in total.

justsomeboy
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Mon Mar 06, 2006 12:37 am
Contact:

Re: SEF & .htaccess - How I got mine to work on a hosted server

Post by justsomeboy » Mon Mar 27, 2006 12:27 pm

I'll definitely take note of your post and try my other options.....again!  :laugh:  This SEF is such a pain, and there really needs to be more focus on it for upcoming releases!  Thanks.  :D

User avatar
tj.baker
Joomla! Apprentice
Joomla! Apprentice
Posts: 14
Joined: Tue Feb 14, 2006 6:23 am
Location: Visalia, CA
Contact:

Re: SEF & .htaccess - How I got mine to work on a hosted server

Post by tj.baker » Sat Apr 01, 2006 9:02 am

I followed your lead and I now have SEF working on my site!!!  :D  Only thing is, after I log in as a user things go back to being regular J! addresses.... I'll have to look into that!

Also, I checked out your site.... did you use SEF Advanced to get your urls?

Thanks for the info......

peace

tj

*Correction*  The URL's that aren't being made SEF are ones that were links created in JCE......  Any input on that?
Last edited by tj.baker on Sat Apr 01, 2006 9:10 am, edited 1 time in total.
http://www.azariasage.org- My Angel Azaria
http://www.opensource.org/docs/osd - Open Source DOES matter!

Aquabri
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Mon Feb 20, 2006 10:30 pm

Re: SEF & .htaccess - How I got mine to work on a hosted server

Post by Aquabri » Sat Apr 01, 2006 1:44 pm

Yep am using SEF advance now, and google has started indexing my pages! YAY! :D was very nervous about loosing position in the transition from flat HTML to this CRM as it looked quite bad for the first week, but 50 pages got indexed last night. :)

Sorry can't help with your JCE links

User avatar
stingrey
Joomla! Engineer
Joomla! Engineer
Posts: 360
Joined: Mon Aug 15, 2005 4:36 pm
Location: Marikina, Metro Manila, Philippines
Contact:

Re: SEF & .htaccess - How I got mine to work on a hosted server

Post by stingrey » Sat Apr 01, 2006 2:12 pm

justsomeboy wrote:This SEF is such a pain, and there really needs to be more focus on it for upcoming releases!  Thanks.  :D

This is why it is an option only and not on be default as the number of different permutations of server setups is simply beyond scope to cater for, especially when the are sometimes contradictory.

Also depending on the way a server is setup, it is not always possible to change the server configurations.
Hence why using SEF is something that you need to determine whether you really need.

Google is quite able to spider non sef links and there is a certain overhead with using SEF and even more with the more advanced SEF options available.
Joomla! Core Team Member
Software Coding and Design - Stability Team Leader

God grant me the Serenity to Accept the things I cannot change, the Courage to change the things I can and the Wisdom to know the Difference.

justsomeboy
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Mon Mar 06, 2006 12:37 am
Contact:

Re: SEF & .htaccess - How I got mine to work on a hosted server

Post by justsomeboy » Sat Apr 01, 2006 5:40 pm

stingrey wrote:
justsomeboy wrote:This SEF is such a pain, and there really needs to be more focus on it for upcoming releases!  Thanks.  :D

This is why it is an option only and not on be default as the number of different permutations of server setups is simply beyond scope to cater for, especially when the are sometimes contradictory.

Also depending on the way a server is setup, it is not always possible to change the server configurations.
Hence why using SEF is something that you need to determine whether you really need.

Google is quite able to spider non sef links and there is a certain overhead with using SEF and even more with the more advanced SEF options available.


Although it would be outstanding, I understand the fact that "one shoe doesn't fit all."  There are plenty of sites that I've noticed which do not use SEF and they are still indexed by Google.  For example, my site is now being indexed, although not very well, but I've submitted my sitemap to Google as well as had a few of my articles become really popular on sites like Digg.com and Lifehacker.com.

Don't get me wrong, I'm no PHP coder and I really don't know much at all about the Core of Joomla, but I believe there just has to be a better SEF solution in the end.  Please take my words kindly and not as criticism. I'm merely offering opinions, and sorry to say I can't offer actual suggestions. :(

CoolKidd

Re: SEF & .htaccess - How I got mine to work on a hosted server

Post by CoolKidd » Mon Sep 04, 2006 1:55 am

Whew...  this post really saved me a lot!  I have been editing my .htaccess for almost 2 days now (I also been seeing 500 and 403 errors) and all I needed to do is uncomment Rewrite engine on  :)

Thanks for the help!

CarolyneSmith

Re: SEF & .htaccess - How I got mine to work on a hosted server

Post by CarolyneSmith » Sat Sep 23, 2006 11:04 am

Thanks very much for posting this, it was a great help!

I never did find a htaccess.txt - I think it was created as .htacess
I copied and pasted in the section Quote from: Bri's .htaccess and it worked!

I added in (at the end of the file) the section to help prevent common exploits:

########## 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

Post Reply