SearchSearch   

mod_rewrite trouble

 
   Webmaster Forums (Home) -> Apache RSS
Next:  [Rewrite Newbie] Rules question  
Author Message
IamDave

External


Since: Aug 10, 2007
Posts: 5



(Msg. 1) Posted: Fri Aug 10, 2007 2:05 pm
Post subject: mod_rewrite trouble
Archived from groups: alt>apache>configuration (more info?)

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
Back to top
Davide Bianchi

External


Since: Oct 23, 2004
Posts: 3383



(Msg. 2) Posted: Fri Aug 10, 2007 4:10 pm
Post subject: Re: mod_rewrite trouble
Imported from groups: per prev. post (more info?)

This message is not archived
Back to top
IamDave

External


Since: Aug 10, 2007
Posts: 5



(Msg. 3) Posted: Sat Aug 11, 2007 8:57 am
Post subject: Re: mod_rewrite trouble
Archived from groups: per prev. post (more info?)

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 <davideyeahs....RemoveThis@onlyforfun.net>
wrote:
> On 2007-08-10, IamDave <raven....RemoveThis@gmail.com> 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
Back to top
Davide Bianchi

External


Since: Oct 23, 2004
Posts: 3383



(Msg. 4) Posted: Sat Aug 11, 2007 12:02 pm
Post subject: Re: mod_rewrite trouble
Imported from groups: per prev. post (more info?)

This message is not archived
Back to top
IamDave

External


Since: Aug 10, 2007
Posts: 5



(Msg. 5) Posted: Mon Aug 13, 2007 4:26 pm
Post subject: Re: mod_rewrite trouble
Archived from groups: per prev. post (more info?)

On Aug 11, 5:02 am, Davide Bianchi <davideyeahs....RemoveThis@onlyforfun.net>
wrote:
> On 2007-08-11, IamDave <raven....RemoveThis@gmail.com> 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:

<VirtualHost *>
ServerAdmin dwill.RemoveThis@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
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/ravenflight>
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/
</Directory>

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

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/"
# <Directory "/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
# </Directory>

</VirtualHost>
Back to top
Davide Bianchi

External


Since: Oct 23, 2004
Posts: 3383



(Msg. 6) Posted: Mon Aug 13, 2007 7:23 pm
Post subject: Re: mod_rewrite trouble
Imported from groups: per prev. post (more info?)

This message is not archived
Back to top
IamDave

External


Since: Aug 10, 2007
Posts: 5



(Msg. 7) Posted: Wed Aug 15, 2007 3:02 am
Post subject: Re: mod_rewrite trouble
Archived from groups: per prev. post (more info?)

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 <davideyeahs....TakeThisOut@onlyforfun.net>
wrote:
> On 2007-08-13, IamDave <raven....TakeThisOut@gmail.com> 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.
>
> ><VirtualHost *>
> > ServerAdmin dw....TakeThisOut@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
Back to top
IamDave

External


Since: Aug 10, 2007
Posts: 5



(Msg. 8) Posted: Thu Aug 16, 2007 8:22 pm
Post subject: Re: mod_rewrite trouble
Archived from groups: per prev. post (more info?)

On Aug 15, 12:49 am, IamDave <raven... DeleteThis @gmail.com> 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 <davideyeahs... DeleteThis @onlyforfun.net>
> wrote:
>
> > On 2007-08-13, IamDave <raven... DeleteThis @gmail.com> 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.
>
> > ><VirtualHost *>
> > > ServerAdmin dw... DeleteThis @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
Back to top
Davide Bianchi

External


Since: Oct 23, 2004
Posts: 3383



(Msg. 9) Posted: Fri Aug 17, 2007 3:02 am
Post subject: Re: mod_rewrite trouble
Imported from groups: per prev. post (more info?)

This message is not archived
Back to top
Display posts from previous:   
       Webmaster Forums (Home) -> Apache
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum