Forum Moderators: coopster & phranque

Message Too Old, No Replies

mod_rewrite doesn't seem to be working

isn't it included as default with apache2.0?

         

incywincy

9:39 pm on Apr 8, 2003 (gmt 0)

10+ Year Member



hi,

i have an off-line development machine running redhat8.0/apache2.0. i use this machine to develop cgi scripts, mainly using tcl.

i have been trying to do some url rewriting using mod_rewrite and as suggested in earlier posts i have tried the simplest rewrite from sillyfile.html to index.html but i am getting the following error in my error log:

[Tue Apr 08 21:28:24 2003] [error] [client 66.87.12.73] File does not exist: /var/www/html/develop/sillyfile.html

i have checked my httpd.conf file which shows a line loading the mod_rewrite module and this module does exist

my .htaccess file contains:
RewriteEngine on
RewriteBase /
RewriteRule ^sillyfile\.html$ /index.html [L]

i have verified my .htaccess file by trying it out on a temporary domain name on my live webserver and it rewrites just fine. i would prefer not to develop scripts on my live webserver.

i wonder if anyone could advise me on what to try next? i'm quickly running out of ideas.

thanks in advance

figment88

10:23 pm on Apr 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am far from an expert on this, but I have learned that you need to make a few additional changes to your httpd.conf in addition to uncommenting the LoadModule line.

In the directory block that sets up your DocumentRoot, e.g.


#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "C:\FoxServ\www">

#more stuff

</Directory>


Note: your config will be diferent where it says Foxserv/www

1) Comment out the current "options" such as Indexes and Followsymlinks and instread use


Options Indexes FollowSymLinks MultiViews ExecCGI

I read in another forum that this should be all on one line even though the default config puts it on multiple.

2) change "AllowOverride None" to "AllowOverride All"

Good luck, last year mod_rewrite was second only to Overture editors for loss of my hair.

jdMorgan

10:24 pm on Apr 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Incywincy,

As long as .htaccess and index.html exist in the directory where you are testing, this should work.

It is often necessary to add
Options +FollowSymLinks
ahead of the RewriteEngine on directive, but in cases where this is necessary, you'll get a 500 server error telling you that you need to enable SymLinks.

If your .htaccess is above the directory where you wish to access sillyfile.html, then do not use a start anchor (^) on the pattern, i.e., use
RewriteRule sillyfile\.html$ /index.html [L]
or include the subdirectory path in the pattern, i.e.
RewriteRule ^subdir/sillyfile\.html$ /index.html [L]

Jim