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 [SOLVED]
- Date: Sun, 20 Aug 2006 12:50:36 +0900
- From: Dave M G <martin@example.com>
- Subject: Re: [tlug] [OT] Creating user-friendly URLS with mod_rewrite/Apache [SOLVED]
- References: <44E53F8A.90605@example.com> <20060818204827.a5e89511.godwin.stewart@example.com> <44E66ED4.7060809@example.com> <d8fcc0800608182158n6dc248b8l3742fba40980a81f@example.com> <44E6A74C.9080800@example.com> <d8fcc0800608190254q608f2cc9v69293daf3839e317@example.com> <44E7209B.40009@example.com> <20060819182744.7e32472b.godwin.stewart@example.com> <44E74AFB.8080803@example.com> <20060820000517.b9f6912a.godwin.stewart@example.com> <d8fcc0800608191618g161bd6cfn1f99ee996107b62@example.com>
- User-agent: Thunderbird 1.5.0.5 (X11/20060728)
Josh, Thank you for your help.I'm happy to report that the issue is solved. I am getting nice friendly URLs, so mod_rewrite seems to be working.It should be noted, though, that even though mod-rewrite is working, it isn't listed when I run "/usr/sbin/apache2 -l". I don't know if that's odd behaviour or not, just that it seemed like it was supposed to be listed there.For my own reference as well as others, although the path to the answer was a little stumbly, here are the steps that I think ultimately lead to getting everything to work:1. # sudo a2enmod rewrite 2. Confirm that the "rewrite.load" file is in /etc/apache2/mods-enabled Currently I have the following files in that directory: cgi.load php5.conf php5.load rewrite.load 3. # sudo gedit /etc/apache2/sites-available/default Find where it says: <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from allAnd change "AllowOverride None" to "AllowOverride all". (I noticed that "None" was in upper case, and "all" was lowercase. Don't know if case is important, but this is the way that it worked for me).Some sites said to edit /etc/apache2/sites-enabled/000-default, or sometimes "default-000", but they are just symlinks to /etc/apache2/sites-available/default (at least in my case).4. # sudo gedit /etc/apache2/httpd.conf Add the following lines: <IfModule mod_rewrite.c> RewriteEngine On </IfModule>No other editing of httpd.conf was necessary, despite some sites that said to use "LoadModule".5. Reload the apache modules and restart Apache. # sudo /etc/init.d/apache2 force-reload # sudo /etc/init.d/apache2 restart6. Create an .htaccess file (if there isn't one already) in the directory where one wants to create "user friendly URLS", and add the following:RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*) index.phpAs David explained, this should set it so that "If the requested URI matches a real file or directory, proceed as normal. If not, call index.php (or whatever you set it to) which then needs to take care of the request one way or the other (for example send 404 if it's a missing image file)"If anyone can see problems in the above, or if I've misunderstood some part, please let me know.Thanks to Josh, David, Godwin, Stephen, Romans, Edmund, and all of TLUG for their ever-present great support.-- Dave M G
- Follow-Ups:
- Re: [tlug] [OT] Creating user-friendly URLS with mod_rewrite/Apache [SOLVED]
- From: Godwin Stewart
- 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: Godwin Stewart
- 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: Josh Glover
- 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: Josh Glover
- 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: Godwin Stewart
- 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: Godwin Stewart
- Re: [tlug] [OT] Creating user-friendly URLS with mod_rewrite/Apache
- From: Josh Glover
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 [SOLVED]
- 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 [SOLVED]
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links