Koozali.org: home of the SME Server

htaccess on SME7

arch-stanton

htaccess on SME7
« on: November 27, 2005, 05:45:42 PM »
Hello,

I have started to use the SME7 Beta8, I have searched the forums and contrib’s  and I have managed to install phpmyadmin, everything is working fine with the exception of htaccess.

I am installing Mambo/Joomla and to have the CMS search engine friendly I must use their .htaccess file to invoke the module_rewrite.

After searching I found this RPM “e-smith-htaccess-1.1-2.noarch.rpm” however, when I install this rpm I get a HTTP ERROR “You are not authorised to view this page”

When I remove the rpm the error is gone.

Can anybody give me some pointers on how to get htaccess working.

Thanks in advance

Offline raem

  • *
  • 3,972
  • +4/-0
Re: htaccess on SME7
« Reply #1 on: November 28, 2005, 03:35:52 AM »
arch-stanton

Search here for a htaccess HOWTO, type htaccess in the search window at top right corner and look at web links.
I'm not sure if it works on sme 7beta, but the concepts are the same.

Let me know your results.
...

djhomeless

htaccess on SME7
« Reply #2 on: December 20, 2005, 10:50:12 PM »
Hi Ray,
I'm also using SME7b8 but this contrib will not install. I'm not sure if this is the sort of thing that should be reported to the bug tracker?

I've used this contrib previously with 6.x and 6.5. I basically need it to enable mod_rewrite for Joomla and Wordpress.

thanks in advance,

Geoffrey

Offline raem

  • *
  • 3,972
  • +4/-0
htaccess on SME7
« Reply #3 on: December 21, 2005, 05:36:12 AM »
djhomeless

> I'm also using SME7b8 but this contrib will not install.

Re e-smith-htaccess-1.1-2.noarch.rpm
You should really track down the author of that contrib rpm and report it to him/her. Look inside the rpm for possible author details.


Note that my HOWTO and the contrib rpm are different things.
If you follow the steps outlined in the HOWTO to create a custom template you do not need the rpm contrib.

I have not proven the HOWTO steps work on 7beta8 though, so let me know if it does or doesn't.
...

bmph8ter

htaccess on SME7
« Reply #4 on: December 21, 2005, 06:26:10 PM »
Not to just butt in on this conversation, but can I infer that .htaccess files are not supported by the current 7.x betas out of the box?

Is there any reason for this?  It's something (that to me anyway) seems to be used by lots and lots of people and I (personally) think it would be nice to have it just work.  Some of the PHP settings I've run into and had to change (open_basedir, etc) I can understand from a security standpoint, but not allowing .htaccess by default doesn't make any sense to me.

Perhaps there is somewhere I could read about this design decision and become better informed.  Sorry for hijacking this thread, and developers thanks for all your hard work!

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
htaccess on SME7
« Reply #5 on: December 22, 2005, 12:03:30 AM »
Quote from: "bmph8ter"
Not to just butt in on this conversation, but can I infer that .htaccess files are not supported by the current 7.x betas out of the box?

Is there any reason for this?


It's completely unnecessary, because a small custom template fragment will achieve the same result in a more secure fashion.

bmph8ter

htaccess on SME7
« Reply #6 on: December 22, 2005, 12:46:04 AM »
Quote from: "CharlieBrady"

It's completely unnecessary, because a small custom template fragment will achieve the same result in a more secure fashion.


But is that something that will always be supported?  I try to be cautious about making modifications to my server as I REALLY like it when things like upgrades and security updates go accoring to plan. Thanks for the answer Charlie.

Offline raem

  • *
  • 3,972
  • +4/-0
htaccess on SME7
« Reply #7 on: December 22, 2005, 01:00:45 AM »
Hey bmph8ter

The htaccess HOWTO I wrote was based on a forum post by Charlie Brady.

The whole point of the templating process is that you can make custom changes to your server and if something breaks you can easily return it to it's previous condition.
ie
create custom template fragment, expand template.
delete custom template fragment, expand template.

Try it on sme 7bet8 and let us know the outcome.

http://mirror.contribs.org/smeserver/contribs//rmitchell/smeserver/howto/htaccess%20configuration%20with%20custom%20templates%20HOWTO%20for%20sme%20server.htm
...

bmph8ter

htaccess on SME7
« Reply #8 on: December 22, 2005, 05:27:54 AM »
Cool.  Thank you gentlemen very much for your answers.  :pint:

djhomeless

htaccess on SME7
« Reply #9 on: December 23, 2005, 08:51:13 AM »
Hi Ray,
Great HOWTO. Only problem is that it doesn't help me. :)

My problem is that I'm not using htaccess to restrict access to a directory or file as your HOWTO discusses. I need/use htaccess to implement mod_rewrite on a per-site basis. I run a few sites off my server, and each site uses a different system to manage it. These include Wordpress, Mambo/Joomla, and Gallery (I also used to use Drupal). In each case, the applications have an ability to use Clean URL's ie rewriting a query string to be a nice readable url (ergo something.php?article=12 becomes helloworld.html).

What happens behind the scenes is when you create a new file or entry, the system of choice then writes to the local htaccess file to insert the rule. While your template covers just access rights, I suppose it could also insert re-write rules. However, it would be a bit time consuming because you would have to update the template (and rebuild) every time you created a new page.

I can appreciate that some aspects of using an htaccess file can be a security risk, but this isn't one of those cases. Surely there is a way to globally allow htaccess files?

From my perspective, I would never have a reason to use htaccess to restrict access to a folder or file, and if I did, the template procedure you and Charley wrote seems fairly easy to follow.

My 2 cents,

Geoffrey

djhomeless

htaccess on SME7
« Reply #10 on: December 27, 2005, 09:21:30 AM »
Does anyone know how to enable htaccess files in SME7? I've tried contacting the author of the contrib but I've received no reply....well, it is the holidays after all!

Thanks,

Geoffrey

djhomeless

htaccess on SME7
« Reply #11 on: December 27, 2005, 09:54:42 AM »
....it's the simple stuff that gets you.

It's the allowoveride directive in httpd.conf that is restricting the htaccess files. Simply by changing None to All in 90e-smithAccess40ibays (in my custom folder) solves my problem.

However, I wish I knew more about how the SME templating process works as I would prefer to only enable htaccess on an as-need basis. At the moment, out of the 10 domains I host only 2 need mod_rewite.

For me, the risk is minimal because my data is not sensitive, and I don't need to restrict access to a folder. However, others should think twice before enabling it (if its not really needed).

Geoffrey

arch-stanton

htaccess on SME7
« Reply #12 on: December 31, 2005, 03:22:03 PM »
I used the yum update on SME7 B8 and then reinstalled the, e-smith-htaccess-1.1-2.noarch.rpm

The update seems to have done the trick

.htaccess is now working fine, I’m using it on Joomla with the SEF module enabled, here’s my .htaccess

Code: [Select]

##
# @version $Id: htaccess.txt 1005 2005-11-13 17:33:59Z stingrey $
# @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

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

# RewriteBase /YourJoomlaDirectory
#  Rules

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


[/code]

deunan

htaccess on SME7
« Reply #13 on: January 07, 2006, 04:54:38 PM »
Okays...

I followed RayMitchell's Howto (which was based on Charlie Brady's), and proceeded to create a custom template..

I'm trying to install postnuke with xanthia's shorturls..

Code: [Select]

<Directory /home/e-smith/files/ibays/ibayname/html>

Options FollowSymLinks

RewriteEngine On

# index.php and user.php
RewriteRule ^changelang-([^-]+)\.html$ index.php?newlang=$1 [L,NC,NS]
RewriteRule ^changetheme-([^-]+)\.html$ index.php?theme=$1 [L,NC,NS]
RewriteRule ^index\.html$ index.php [L,NC,NS]
RewriteRule ^user\.html$ user.php [L,NC,NS]


#Lotsa stuff here deleted...

</Directory>


Seems that, when I expand the template, and restarted apache

Code: [Select]

/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf
/etc/rc.d/rc7.d/S86httpd-e-smith restart


The whole ibay got locked - 403

Other ibays is okay, except the one specified...

But if I removed RewriteEngine

Code: [Select]
#RewriteEngine On

It's works again, but shorturl doesn't work...

Can someone tell me where did I do wrong?  Or did I omit somethinbg crucial?

I really want to nail this thing...


Sincere regards amd thanks!

Pacjack

htaccess on SME7
« Reply #14 on: April 03, 2006, 03:23:02 PM »
Quote from: "arch-stanton"
I used the yum update on SME7 B8 and then reinstalled the, e-smith-htaccess-1.1-2.noarch.rpm

The update seems to have done the trick

Does not work for me :(

I'm using SME Server 7.0rc1

Code: [Select]

# rpm -Uvh http://mirror.contribs.org/smeserver/contribs//nightspirit/e-smith                                           -htaccess/e-smith-htaccess-1.1-2.noarch.rpm
Retrieving http://mirror.contribs.org/smeserver/contribs//nightspirit/e-smith-htaccess/e-smi                                           th-htaccess-1.1-2.noarch.rpm
Preparing...                ########################################### [100%]
   1:e-smith-htaccess       ########################################### [100%]
WARNING in /etc/e-smith/templates-custom//etc/httpd/conf/httpd.conf/90e-smithAccess40ibays: *WARNING* esmith::config(/home/e-smith/accounts) called with old database path. The following package needs to be updated:  at /usr/lib/perl5/site_perl/esmith/config.pm line 374
        esmith::config::TIEHASH('esmith::config', '/home/e-smith/accounts') called at /etc/e-smith/templates-custom//etc/httpd/conf/httpd.conf/90e-smithAccess40ibays line 7
        eval 'package esmith::__TEMPLATE__::1; ;
#line 5 /etc/e-smith/templates-custom//etc/httpd/conf/httpd.conf/90e-smithAccess40ibays
...

;' called at /usr/lib/perl5/vendor_perl/5.8.5/Text/Template.pm line 319
        Text::Template::fill_in('Text::Template=HASH(0x8d37f18)', 'HASH', 'ARRAY(0x8ba1104)', 'PACKAGE', 'esmith::__TEMPLATE__::1', 'BROKEN', 'CODE(0x8d2a9c0)', 'UNTAINT', 1, ...) called at /usr/lib/perl5/vendor_perl/5.8.5/Text/Template.pm line 382
        Text::Template::fill_in_file('/etc/e-smith/templates-custom//etc/httpd/conf/httpd.conf/90e-...', 'HASH', 'A                                           RRAY(0x8ba1104)', 'PACKAGE', 'esmith::__TEMPLATE__::1', 'BROKEN', 'CODE(0x8d2a9c0)', 'UNTAINT', 1, ...) called at /usr/lib/perl5/site_perl/esmith/templates.pm line 528
        esmith::templates::processTemplate('HASH(0x8a04f4c)') called at /sbin/e-smith/expand-template line 45
WARNING: Template processing succeeded for //etc/httpd/conf/httpd.conf: 1 fragment generated warnings
 at /sbin/e-smith/expand-template line 45