Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] [OT] Creating user-friendly URLS with mod_rewrite/Apache
- Date: Fri, 18 Aug 2006 19:09:47 +0300
- From: "romans malinovskis" <romaninsh@example.com>
- Subject: Re: [tlug] [OT] Creating user-friendly URLS with mod_rewrite/Apache
- References: <44E53F8A.90605@example.com> <20060818.145626.239386559.dave@???> <44E57D79.9010808@example.com> <931e6e80608180747g40ca3d5aj1da3a3865fa22cb7@example.com> <44E5DA8A.3080105@example.com>
> make sure you have > Options +AllowOverride > for the directory where .htaccess is. Am I correct that the "Options +AllowOverride" option goes into my httpd.conf file?yesMy current httpd.conf file has only this, which makes me unconfident that it's the right file: # This is here for backwards compatability reasons and to support # installing 3rd party modules directly via apxs2, rather than # through the /etc/apache2/mods-{available,enabled} mechanism. # #LoadModule mod_placeholder /usr/lib/apache2/modules/mod_placeholder.so ServerName localhost The apache.org file is a little hard to grasp when it comes to determining the right syntax to use here.The way how apache conf works varies from distribution. Main file usually includes some other files to configure virtual hosts and modules. Assuming that you edit the proper file, you can place something like: <Directory /path/to/dir> Options +AllowOverride </Directory>Is there a global way I can say to always obey the directives of a local .htaccess file if it present in a directory?<Directory /Path/To/DocumentRoot> Options +AllowOverride </Directory> any subdirectory will respect .htaccess"However, in general, use of .htaccess files should be avoided when possible. Any configuration that you would consider putting in a .htaccess file, can just as effectively be made in a <Directory> section in your main server configuration file."This is off by default for two reasons - if you request /dir/a/b/c, then it apache would check directories "dir", "dir/a", "dir/a/b" and "dir/a/b/c" for .htaccess. It performs stat() and parse .htaccess every request which might slow down a bit if you are doing 500-1000 requests per sec. - whoever have access to subdirectories of "dir" will be able to put his own .htaccess files. I'm not sure about this, but maybe they can tell apache to follow sym links and symlink /etc. But if you have PHP, noone would bother :) If you have live production server, you can do the same thing if you put contents of your .htaccess file into <Directory> or <Location> directive. <VirtualHost example.com> <Location /> RewriteEngine On RewriteRule.... .... </Location> </VirtualHost>Hmm... well, I do have access to my Apache configuration files on both my home environment and my hosting service. Although, I think for portability reasons I should probably stick to using an .htaccess file. What do you guys think is better?If you distribute code, .htaccess is easier. On many hosts who provide webservice, mod_rewrite and override are on by default. So unless you are building a High Availability server, keep it in .htaccess. romans http://grr.void.lv/cv
- Follow-Ups:
- References:
- [tlug] [OT] Creating user-friendly URLS with mod_rewrite/Apache
- From: Dave M G
- Re: [tlug] [OT] Creating user-friendly URLS with mod_rewrite/Apache
- From: David E
- Re: [tlug] [OT] Creating user-friendly URLS with mod_rewrite/Apache
- From: Dave M G
- Re: [tlug] [OT] Creating user-friendly URLS with mod_rewrite/Apache
- From: romans malinovskis
- Re: [tlug] [OT] Creating user-friendly URLS with mod_rewrite/Apache
- From: Dave M G
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] [OT] Creating user-friendly URLS with mod_rewrite/Apache
- Next by Date: Re: [tlug] [OT] Creating user-friendly URLS with mod_rewrite/Apache
- Previous by thread: Re: [tlug] [OT] Creating user-friendly URLS with mod_rewrite/Apache
- Next by thread: Re: [tlug] [OT] Creating user-friendly URLS with mod_rewrite/Apache
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links