mod_rewrite trouble

mod_rewrite trouble

am 10.08.2007 16:05:24 von IamDave

I'm kinda new to this and I'm having trouble getting mod_rewrite to
work with Apache 2.2 on Ubuntu 7.04. I ran the command "sudo a2enmod
rewrite" and it said that the module was installed. I then did a
force-reload on the server and have since restarted the server several
times. As a test, in my .htaccess file I put the following:

Options +FollowSymlinks

RewriteEngine On
RewriteRule ^dave\.html$ test.php [R]

But it doesn't do anything. I've also tried putting this stuff in the
virtual host config file and it didn't do anything there either. I
don't have any idea what else to try and hours of Googling haven't
revealed anything useful. I'm beginning to wonder if maybe
mod_rewrite is an elaborate hoax.
Dave

Re: mod_rewrite trouble

am 10.08.2007 16:10:58 von unknown

Post removed (X-No-Archive: yes)

Re: mod_rewrite trouble

am 11.08.2007 10:57:02 von IamDave

Okay, I added RewriteLog /etc/apache2/sites-enabled/rewrite_log.txt to
the virtual host configuration but nothing has been logged. Does that
mean that even though the module is installed it's not activated or
something? Where should I go from here? And thanks for responding!
Dave

On Aug 10, 9:10 am, Davide Bianchi
wrote:
> On 2007-08-10, IamDave wrote:
>
> > As a test, in my .htaccess file I put the following:
>
> > Options +FollowSymlinks
>
> > RewriteEngine On
> > RewriteRule ^dave\.html$ test.php [R]
>
> First step when debugging something is to enable logging and see if it
> does start logging and what it says, so add a RewriteLog somewhere and
> see if you get something logged in. If it doesn't, then the Rewrite
> directives are ignored.
>
> When you get the info, check what does it says.
>
> One step at a time.
>
> Davide
>
> --
> If Microsoft were to vanish, who would we hate next?
> -- From a Slashdot.org post

Re: mod_rewrite trouble

am 11.08.2007 12:02:14 von unknown

Post removed (X-No-Archive: yes)

Re: mod_rewrite trouble

am 13.08.2007 18:26:25 von IamDave

On Aug 11, 5:02 am, Davide Bianchi
wrote:
> On 2007-08-11, IamDave wrote:
>
> > Okay, I added RewriteLog /etc/apache2/sites-enabled/rewrite_log.txt to
> > the virtual host configuration but nothing has been logged. Does that
> > mean that even though the module is installed it's not activated or
> > something?
>
> If the log file shows up, it means that the module is loaded and the
> directive is read, but the rewrite rule is never applied or reached.
> On the other hand, if the log doesn't even appear, it means that the
> vhost is never initialized. Since your rewrite rule is in the .htaccess
> file, are you sure that file is processed? Do you have an
> AllowOverride in your vhost?
>
> > Where should I go from here?
>
> I suggest you use apachectl configtest to check if there are obvious
> errors in your configuration, then post your configuration so we can
> have a look and maybe spot the error.
>
> Davide
>
> --
> Who's this 'general failure'? And why is he reading my disk??

Okay, I did that and it said the syntax was ok. Also, the log file is
showing up but nothing is being logged in it. I was initially putting
the rewrite stuff in the vhost but I switched to .htaccess to see if
it made a difference. I've gone back to doing it in the vhost now and
below is my configuration:


ServerAdmin dwill@ravenflight.net
ServerName www.ravenflight.net
ServerAlias ravenflight.net

RewriteEngine On
RewriteLog /etc/apache2/sites-enabled/rewrite_log.txt
RewriteRule ^dave\.html$ test.php [R]

DocumentRoot /var/www/ravenflight

Options FollowSymLinks
AllowOverride None


Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# Uncomment this directive is you want to see
apache2's
# default start page (in /apache2-default) when you go
to /
#RedirectMatch ^/$ /apache2-default/


# ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
#
# AllowOverride None
# Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
# Order allow,deny
# Allow from all
#


ErrorLog /var/log/apache2/ravenflighterror.log

# Possible values include: debug, info, notice, warn, error,
crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/ravenflightaccess.log combined
ServerSignature On

# Alias /doc/ "/usr/share/doc/"
#
# Options Indexes MultiViews FollowSymLinks
# AllowOverride None
# Order deny,allow
# Deny from all
# Allow from 127.0.0.0/255.0.0.0 ::1/128
#


Re: mod_rewrite trouble

am 13.08.2007 19:23:56 von unknown

Post removed (X-No-Archive: yes)

Re: mod_rewrite trouble

am 15.08.2007 07:49:30 von IamDave

Okay, I added the / and it still doesn't do anything. I'm really
confused. I'm certainly no expert but I can't see any reason why this
isn't working.
Dave

On Aug 13, 12:23 pm, Davide Bianchi
wrote:
> On 2007-08-13, IamDave wrote:
>
> > Okay, I did that and it said the syntax was ok. Also, the log file is
> > showing up but nothing is being logged in it.
>
> Ok, so the Rewrite module is loaded but for some reason the rewrite rule
> never work.
>
> >
> > ServerAdmin dw...@ravenflight.net
> > ServerNamewww.ravenflight.net
> > ServerAlias ravenflight.net
>
> > RewriteEngine On
> > RewriteLog /etc/apache2/sites-enabled/rewrite_log.txt
> > RewriteRule ^dave\.html$ test.php [R]
>
> This will only work if your request begins with 'dave' without a '/',
> maybe you need to add a '/' ?
> RewriteRule ^/dave\.html$ /test.php [R]
>
> > AllowOverride None
>
> This will basically disable the .htaccess file
>
> > #RedirectMatch ^/$ /apache2-default/
>
> See? there is a '/'
>
> Davide
>
> --
> I'm still waiting for the marketing slogan: Retry Reboot Reinstall Reformat
> Redhat -- Alan

Re: mod_rewrite trouble

am 16.08.2007 22:22:08 von IamDave

On Aug 15, 12:49 am, IamDave wrote:
> Okay, I added the / and it still doesn't do anything. I'm really
> confused. I'm certainly no expert but I can't see any reason why this
> isn't working.
> Dave
>
> On Aug 13, 12:23 pm, Davide Bianchi
> wrote:
>
> > On 2007-08-13, IamDave wrote:
>
> > > Okay, I did that and it said the syntax was ok. Also, the log file is
> > > showing up but nothing is being logged in it.
>
> > Ok, so the Rewrite module is loaded but for some reason the rewrite rule
> > never work.
>
> > >
> > > ServerAdmin dw...@ravenflight.net
> > > ServerNamewww.ravenflight.net
> > > ServerAlias ravenflight.net
>
> > > RewriteEngine On
> > > RewriteLog /etc/apache2/sites-enabled/rewrite_log.txt
> > > RewriteRule ^dave\.html$ test.php [R]
>
> > This will only work if your request begins with 'dave' without a '/',
> > maybe you need to add a '/' ?
> > RewriteRule ^/dave\.html$ /test.php [R]
>
> > > AllowOverride None
>
> > This will basically disable the .htaccess file
>
> > > #RedirectMatch ^/$ /apache2-default/
>
> > See? there is a '/'
>
> > Davide
>
> > --
> > I'm still waiting for the marketing slogan: Retry Reboot Reinstall Reformat
> > Redhat -- Alan

Could there be something in apache.conf or some other configuration
file that's preventing this from working? Since you didn't see
anything wrong in with my vhost configuration I guess it has to be
somewhere else, right?
Dave

Re: mod_rewrite trouble

am 17.08.2007 07:26:46 von unknown

Post removed (X-No-Archive: yes)