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

djhomeless

htaccess on SME7
« Reply #15 on: April 03, 2006, 04:22:08 PM »
You don't really need that contrib if all you want to do is enable mod_rewrite.

Just create a template of 90e-smithAccess40ibays in your custom path and enable allowoveride. As I said above, be warned that this will enable allowoveride for all ibays.

Not to rant here, but I don't understand why this was disabled in the first place. Maybe its a security risk for some, but the choice should ultimately be down to the individual sysadmin.

</rant>

my 2 cents,

Geoffrey

Offline slords

  • ****
  • 235
  • +3/-0
htaccess on SME7
« Reply #16 on: April 03, 2006, 09:34:46 PM »
why all this talk of a custom template.  Just set the AllowOverride property of the ibay and update it.

# db accounts setprop wordpress AllowOverride All
# signal-event ibay-modify wordpress

That should be all you need to allow htaccess from an ibay named wordpress.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs,
and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." -- Rich Cook

Pacjack

htaccess on SME7
« Reply #17 on: April 04, 2006, 09:13:52 AM »
Quote from: "slords"
why all this talk of a custom template.  Just set the AllowOverride property of the ibay and update it.

Because CharlieBrady once said:
Quote from: "CharlieBrady"
Using .htaccess is definitely less secure. httpd.conf templates are definitely under admin's control. .htaccess files are not, and could have insecure permissions.

thyeum

htaccess on SME7
« Reply #18 on: October 15, 2006, 12:56:41 AM »
Hi djhomeless,

I've just installed a SME-server box with WordPress, Gallery, and WPG2 and I would like to enable mod_rewrite because all three require it for permalinks.
According to your post it seems easy to do it since you just need to
Quote from: "djhomeless"
create a template of 90e-smithAccess40ibays in your custom path and enable allowoveride.

Unfortunately, I am pretty new at all this, and I have no idea how to do that.
A little help would be greatly appreciated.

Both installations of Wordpress and Gallery are in the Primary ibay.

Thanks,

Mathieu

Offline jameswilson

  • ****
  • 739
  • +0/-0
    • Security Warehouse, trade security equipment
htaccess on SME7
« Reply #19 on: February 25, 2007, 07:51:11 PM »
Hi all im having the same difficulty i need to enable mod_rewrite for wordpress but when i do

Quote
# db accounts setprop wordpress AllowOverride All
# signal-event ibay-modify wordpress


i get 403 errors, i dont understnd what to alter in the template to affect only one ibay but to be honest it would be more use on them all so id like to enable it globally

Offline raem

  • *
  • 3,972
  • +4/-0
htaccess on SME7
« Reply #20 on: February 26, 2007, 05:31:37 AM »
jameswilson

> i get 403 errors

Do you need to use https://....
...

Offline jameswilson

  • ****
  • 739
  • +0/-0
    • Security Warehouse, trade security equipment
htaccess on SME7
« Reply #21 on: February 26, 2007, 12:41:40 PM »
Hi ray no i dont.

Im trying to use .htaccess with mod_rewrite and permalinks with wordpress, i have found with a few rebuilds that if i dont enable the permalinks all is fine, if i enable the permalinks then the urls are requested in the correct way but no content, ie page not found. I assume this is because mod_rewrite isnt rewriting? so i did the above and then things go bad. I get 403 errors all over the ibay. Im assuming its something daft and my limited ability as i have yet to find something sme cant do. Any pointers or help will be great

Thanks Ray

James

Offline russs

  • ***
  • 77
  • +0/-0
htaccess on SME7
« Reply #22 on: March 06, 2007, 05:38:51 PM »
Don't know if anybody is still interested in this but I am trying to get SSL on my KnowledgeTree install on SME 7.
I found this document about making a template for this;

http://mirror.contribs.org/smeserver/contribs/rmitchell/smeserver/howto/htaccess%20configuration%20with%20custom%20templates%20HOWTO%20for%20sme%20server.htm
 
Might be a bit iof an old document now but have a look.
Unfortunately for me, the KnowledgeTree RPM sets it up in the /opt directory so I'm still stuck but though it might help you Guys.

Russ
...

Offline jameswilson

  • ****
  • 739
  • +0/-0
    • Security Warehouse, trade security equipment
htaccess on SME7
« Reply #23 on: March 07, 2007, 11:44:53 AM »
Quote from: "RayMitchell"
jameswilson

> i get 403 errors

Do you need to use https://....


just double checking and with https i still get 'forbidden errors'

im not trying to get ermissions working etc, and i may be well up the wrong tree then, im just trying to gwt wordpress to work with permalinks ie seo url's. Id like to get seo urls accross a few of my ibays but this one is critical for me.

cheers lads

james

Offline william_syd

  • ****
  • 1,608
  • +0/-0
  • Nothing to see here.
    • http://www.magicwilly.info
htaccess on SME7
« Reply #24 on: March 07, 2007, 11:57:06 AM »
Quote from: "russs"
Don't know if anybody is still interested in this but I am trying to get SSL on my KnowledgeTree install on SME 7.
I found this document about making a template for this;

http://mirror.contribs.org/smeserver/contribs/rmitchell/smeserver/howto/htaccess%20configuration%20with%20custom%20templates%20HOWTO%20for%20sme%20server.htm
 
Might be a bit iof an old document now but have a look.
Unfortunately for me, the KnowledgeTree RPM sets it up in the /opt directory so I'm still stuck but though it might help you Guys.

Russ


I have KT3 on SSL

My template..
Code: [Select]

# knowledgetree3
Alias /dms /opt/knowledgetree3
<Directory /opt/knowledgetree3>
    SSLRequireSSL on
    Options -Indexes
    AllowOverride all
    order deny,allow
    deny from all
    allow from all
    Satisfy all
    AddType application/x-httpd-php .php .php3
    php_flag  magic_quotes_gpc  on
    php_flag  track_vars        on
</Directory>




which lives in /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf and is called 86dms

If you did a rpm install yours will probably be in /etc/e-smith/templates/etc/httpd/conf/httpd.conf What it will be called I don't know.
Regards,
William

IF I give advise.. It's only if it was me....

Offline william_syd

  • ****
  • 1,608
  • +0/-0
  • Nothing to see here.
    • http://www.magicwilly.info
htaccess on SME7
« Reply #25 on: March 07, 2007, 12:11:07 PM »
Quote from: "jameswilson"
Quote from: "RayMitchell"
jameswilson

> i get 403 errors

Do you need to use https://....


just double checking and with https i still get 'forbidden errors'

im not trying to get ermissions working etc, and i may be well up the wrong tree then, im just trying to gwt wordpress to work with permalinks ie seo url's. Id like to get seo urls accross a few of my ibays but this one is critical for me.

cheers lads

james



Remove any custom template YOU created.
Remove any .htaccess file in the wordpress ibay.

Then..
Code: [Select]
expand-template /etc/httpd/conf/httpd.conf
db accounts setprop wordpress AllowOverride All
signal-event ibay-modify wordpress


Does wordpress work ? Naturally it will not have SEO.

I have wordpress hosted elsewhere so don't ask me about server details but my .htaccess contains..
Code: [Select]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress


My permalinks look like..
Code: [Select]
http://www.magicwilly.webhostingpal.com/2006/10/04/folly/
Regards,
William

IF I give advise.. It's only if it was me....

Offline jameswilson

  • ****
  • 739
  • +0/-0
    • Security Warehouse, trade security equipment
htaccess on SME7
« Reply #26 on: March 07, 2007, 12:35:09 PM »
william
Thankyou for helping

Wordpress works untill rewrite engine is turned on then i get forbidden errors

Code: [Select]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress


if i turn rewrite engine off, wordpress works again

I removed as you said .htaccess files and i have no templates i have added to this server. I assume then something else is mising but alas i have no idea what

Many thanks

James

Offline william_syd

  • ****
  • 1,608
  • +0/-0
  • Nothing to see here.
    • http://www.magicwilly.info
htaccess on SME7
« Reply #27 on: March 07, 2007, 01:15:52 PM »
What I was getting at is with no .htaccess and no custom templates then setting Allowoveride All should not stop wordpress working.

If the above is true than any errors are generated by the syntax of your .htaccess file.

I was not suggesting that you use mine verbatim but to compare it with what you were trying previously. I'm sure RewriteBase / should be more like RewriteBase /ibayname
Regards,
William

IF I give advise.. It's only if it was me....

Offline jameswilson

  • ****
  • 739
  • +0/-0
    • Security Warehouse, trade security equipment
htaccess on SME7
« Reply #28 on: March 07, 2007, 01:20:57 PM »
william you are correct if i remove the .htaccess file then it works, or if i edit and turn rewrite off it works

The htaccess file is automatically generated by wordpress and as it happens is the same as the one my wordpress generated, i didnt copy and paste yours.

But as an excersise, i installed wordpress onto another server (managed isp server ) as a test and it worked first time using the generated htaccess file.
Maybe its not mod-rewrite thats the problem, maybe i need soemthing else

lol but what god only knows!

Thanks again

James

Offline william_syd

  • ****
  • 1,608
  • +0/-0
  • Nothing to see here.
    • http://www.magicwilly.info
htaccess on SME7
« Reply #29 on: March 07, 2007, 01:24:05 PM »
I did a late edit but try RewriteBase /ibayname in your .htaccess

Does the url for your wordpress contain the ibayname at the end ?
Regards,
William

IF I give advise.. It's only if it was me....

Offline jameswilson

  • ****
  • 739
  • +0/-0
    • Security Warehouse, trade security equipment
htaccess on SME7
« Reply #30 on: March 07, 2007, 01:27:01 PM »
no it doesnt, it is in the root of the ibay httml folder

Offline william_syd

  • ****
  • 1,608
  • +0/-0
  • Nothing to see here.
    • http://www.magicwilly.info
htaccess on SME7
« Reply #31 on: March 07, 2007, 01:38:55 PM »
Quote from: "jameswilson"
no it doesnt, it is in the root of the ibay httml folder


If the ibay is named blog is it not accessed by http://some.server.name/blog ?
Regards,
William

IF I give advise.. It's only if it was me....

Offline jameswilson

  • ****
  • 739
  • +0/-0
    • Security Warehouse, trade security equipment
htaccess on SME7
« Reply #32 on: March 07, 2007, 01:41:18 PM »
i have created an ibay and set a dedicated domain to point to it, so when going to the domain name, obviously sme gets th dats fromthe relavent ibay i presume

Offline jameswilson

  • ****
  • 739
  • +0/-0
    • Security Warehouse, trade security equipment
htaccess on SME7
« Reply #33 on: March 07, 2007, 01:43:14 PM »
being daft and not thinking i have only just checked the logs
Quote
[Wed Mar 07 12:32:11 2007] [error] [client xxx.xxx.xx.xxx] Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /home/e-smith/files/ibays/test/html/


does that help?

Offline william_syd

  • ****
  • 1,608
  • +0/-0
  • Nothing to see here.
    • http://www.magicwilly.info
htaccess on SME7
« Reply #34 on: March 07, 2007, 01:48:32 PM »
Quote from: "jameswilson"
being daft and not thinking i have only just checked the logs
Quote
[Wed Mar 07 12:32:11 2007] [error] [client xxx.xxx.xx.xxx] Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /home/e-smith/files/ibays/test/html/


does that help?


Interesting

Try
Code: [Select]
# db accounts setprop wordpress FollowSymLinks enabled
# signal-event ibay-modify wordpress


wordpress being your ibay name. Looks like test from your log fragment.

BTW.. Bedtime  -Posted: 07 Mar 2007 23:48
Regards,
William

IF I give advise.. It's only if it was me....

Offline jameswilson

  • ****
  • 739
  • +0/-0
    • Security Warehouse, trade security equipment
htaccess on SME7
« Reply #35 on: March 07, 2007, 01:55:32 PM »
you hero!!!
dead on the money.

I offered a reward for this so i will send it. paypal? and where?

Thank you so much for your help too, could never have done it without

Many many thanks

James

Offline jameswilson

  • ****
  • 739
  • +0/-0
    • Security Warehouse, trade security equipment
htaccess on SME7
« Reply #36 on: April 13, 2007, 01:52:52 AM »
I have donated to the project instead
Many thanks All, especially you william for this and the rest of the team for the main bits

James