LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (http://www.linuxquestions.org/questions/debian-26/)
-   -   Apache virtual hosts and mod_rewrite problem (http://www.linuxquestions.org/questions/debian-26/apache-virtual-hosts-and-mod_rewrite-problem-469376/)

Gyper 07-31-2006 09:39 AM

Apache virtual hosts and mod_rewrite problem
 
Hi to all,

I want to test mod_rewrite in my debian box. I have browsed through the net but still not able to make mod_rewrite to work. Below are the steps that I have followed:
---
1. I have enabled mod_rewrite module in Apache2 using a2enmod command.
2. I have created a file "www.mine.org" in /etc/apache2/sites-available with the following entries:
###
<VirtualHost *>
ServerName www.mine.org
DocumentRoot /var/www/mine
ServerAdmin mine@mine.org
ErrorLog /var/log/apache2/www.mine.org-error_log
CustomLog /var/log/apache2/www.mine.org-access_log common
DirectoryIndex index.php

<Directory />
Order Deny,Allow
Allow from all
# Don't show indexes for directories
Options Indexes FollowSymLinks MultiViews
RewriteEngine On
RewriteRule ^/articles/([0-9]+)$ /?article=$1 [PT]

</Directory>
</VirtualHost>

###

3. I have enabled the site through the a2ensite command.
4. I have also have this entry in /etc/hosts:

###
127.0.0.1 localhost.localdomain localhost www.mine.org

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

###

---
I have entered "http://www.mine.org/articles/6" in my browser, I still got a 404 not found error :( I'm stumped on what to do next. Please help.

Thanks in advance.

ckin2001 07-31-2006 12:57 PM

looking at the access/error logs is always a good start - /var/log/apache2/

The only thing that jumps out at me is the [PT]. If you don't have another handler down the line, there is no need for passthrough. The article at debian-administration.com uses it for their cgi scripting - is that where you found this? :D

Gyper 07-31-2006 07:43 PM

Quote:

Originally Posted by ckin2001
looking at the access/error logs is always a good start - /var/log/apache2/

The only thing that jumps out at me is the [PT]. If you don't have another handler down the line, there is no need for passthrough. The article at debian-administration.com uses it for their cgi scripting - is that where you found this? :D


Yes, you're right, I copied the line from debian-administration.com :). I have googled the problem and visited many sites to look for the solution for this problem. I'll try later at home to disable the default virtual host site and also delete the [PT] (actually I have no idea what it does). If it still doesn't work and I'm fresh out of ideas, I'll try the one Apache releases.

Any more ideas guys?

ckin2001 07-31-2006 11:22 PM

The official mod_rewrite reference for rewrite rules is at http://httpd.apache.org/docs/2.0/mod...ml#rewriterule . I would have linked it before, as well as http://www.debian-administration.org/articles/136 - but I hadn't posted enough to be allowed to post URLs.

Good luck


All times are GMT -5. The time now is 02:54 PM.