Koozali.org: home of the SME Server

htaccess question/confirmation

Offline ElFroggio

  • *
  • 262
  • +0/-0
htaccess question/confirmation
« on: November 09, 2014, 06:01:15 AM »
Hi,

I need to create an .htaccess files for redirections, rewrite rules... The new web site is static, no php, no perl, just straight html

Can I still use the:
Code: [Select]
db accounts setprop ibayname AllowOverride All to enable it?

I ask because it will be on a production server and the person responsible for that server is not available for the next while.

Thanks

Syv

Offline janet

  • ****
  • 4,812
  • +0/-0
Re: htaccess question/confirmation
« Reply #1 on: November 09, 2014, 09:20:20 AM »
ElFroggio

For a more secure approach, it is recommended to use a custom template instead of a .htaccess file.
http://wiki.contribs.org/Htaccess
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline DanB35

  • ****
  • 764
  • +0/-0
    • http://www.familybrown.org
Re: htaccess question/confirmation
« Reply #2 on: November 09, 2014, 01:22:45 PM »
Yes, you can use the AllowOverride property to enable .htaccess files; the question is whether you should.  Is it a requirement that users (not the server admin) be able to change the contents of the .htaccess file?  If so, and there's a good reason for that requirement, then you'd need to use .htaccess.  If not, everything that could go in .htaccess can also go within a <Directory> ... </Directory> section in your httpd.conf file.  The Apache docs recommend this method primarily for performance reasons, and it's also marginally more secure.
......

Offline ElFroggio

  • *
  • 262
  • +0/-0
Re: htaccess question/confirmation
« Reply #3 on: November 09, 2014, 04:35:02 PM »
Yes, you can use the AllowOverride property to enable .htaccess files; the question is whether you should.  Is it a requirement that users (not the server admin) be able to change the contents of the .htaccess file?  If so, and there's a good reason for that requirement, then you'd need to use .htaccess.  If not, everything that could go in .htaccess can also go within a <Directory> ... </Directory> section in your httpd.conf file.  The Apache docs recommend this method primarily for performance reasons, and it's also marginally more secure.

Eventually the admin will do it and not the users (the admin is not available for the next while). But it's not about passwords, just a "whole bunch" of rewrites. No write for any user, only apache:shared and the whole website is just static html files.

Is there a better way of doing the rewrites?

Thanks

Syv

Offline DanB35

  • ****
  • 764
  • +0/-0
    • http://www.familybrown.org
Re: htaccess question/confirmation
« Reply #4 on: November 09, 2014, 05:30:06 PM »
The method described at the wiki page Janet cites can be used for any httpd.conf directives.  I thought I'd made some edits to the page to make that clearer, but perhaps it isn't clear enough.

If the directory in question is only admin-writable, then I seriously question whether there's any security difference at all between using a .htaccess file and adding the directives to httpd.conf--I certainly haven't seen any evidence that there's a significant issue, despite a good bit of handwaving.  The Apache docs (http://httpd.apache.org/docs/current/howto/htaccess.html) do recommend avoiding .htaccess files if possible, though.

The wiki article has a lot of stuff about passwords which can obscure the issue, but it boils down to creating a custom httpd.conf template fragment that looks like this:

<Directory /home/e-smith/files/ibays/youribay/html>
RewriteEngine On
RewriteRule whatever
...
</Directory>

Then expand-template /etc/httpd/conf/httpd.conf; service httpd-e-smith restart.
......

Offline ElFroggio

  • *
  • 262
  • +0/-0
Re: htaccess question/confirmation
« Reply #5 on: November 09, 2014, 05:49:54 PM »
Thank you very much for the clarification/confirmation

/Syv

Offline raem

  • *
  • 3,972
  • +4/-0
Re: htaccess question/confirmation
« Reply #6 on: November 10, 2014, 03:00:00 AM »
DanB35

Quote
I thought I'd made some edits to the page to make that clearer, but perhaps it isn't clear enough.

Clarity is something that is not always easily achieved, so I had another go at it too !

Following on from your edits, I have significantly re-arranged & improved the text in the htaccess wiki article.
See
http://wiki.contribs.org/Htaccess
...

Offline ElFroggio

  • *
  • 262
  • +0/-0
Re: htaccess question/confirmation
« Reply #7 on: November 10, 2014, 03:07:02 AM »
Following on from your edits, I have significantly re-arranged & improved the text in the htaccess wiki article.
See
http://wiki.contribs.org/Htaccess

Perfecto!

Thanks