Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to configure my apache server with django. I am having issues matching urls to their views and am not quite sure of the cause of the problem. I have the following configuration:

.htaccess:

AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ cyber.fcgi/ [QSA,L]

urls.py:

from django.conf.urls import patterns, include, url
from django.conf import settings
from views import index, test
from os import path
urlpatterns = patterns('',
    (r'^$', index),
    (r'^test/$', test),
)

The problem I am encountering is that all urls that do not start with /cyber.fcgi/ automatically match the index view. For testing, I am printing the url that view sees:

www.example.com/test/           <= matches index with url /test/
www.example.com/test            <= matches index with url /tes/
www.example.com/cyasdasd/123    <= matches index with url /cyasdasd/12/
www.example.com/cyber.fcgi/     <= matches index with url /cyber.fcgi/
www.example.com/cyber.fcgi/test <= matches test with url /cyber.fcgi/test/
www.example.com/cyber.fcgi/asd  <= no match

It appears that the correct behavior only occurs when /cyber.fcgi is called directly. I am assuming this is a problem with RewriteRule ^(.*)$ cyber.fcgi/ [QSA,L] but I am not entirely sure nor do I know how to fix it. Any help would be appreciated.

share|improve this question

1 Answer 1

up vote 2 down vote accepted
RewriteRule ^(.*)$ cyber.fcgi/$1 [QSA,L]

Missing $1 at the end.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.