2

The issue

I'm writing a cgi script in c++. All works well as long as I go in to the precise url: http://localhost:90/joppli.bot

Now I'm trying to make a simple redirect to from everything to my cgi script. eg:

http://localhost:90/
http://localhost:90/foo
http://localhost:90/foo/bar

...should all render the same content as entering http://localhost:90/joppli.bot


Files

.htaccess

RewriteEngine On

RewriteRule (.+)/$ /$1 [L,R=301]

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ joppli.bot [NC,L]

virtual host

<VirtualHost *:90>
    DocumentRoot /var/www/joppli-bot
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>

    LoadModule fastcgi_module /usr/lib/apache2/modules/mod_fastcgi.so
    SetHandler fastcgi-script
    
    <Directory "/var/www/joppli-bot">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog /var/www/joppli-bot/log/apache2/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /var/www/joppli-bot/log/apache2/access.log combined
</VirtualHost>

files at /var/www/joppli-bot

.htaccess
joppli.bot -> /home/erik/NetBeansProjects/joppli.bot/dist/Debug/GNU-Linux-x86/joppli.bot
log
+ apache2
  + access.log
  + error.log
1
  • 1
    In <Directory "/var/www/joppli-bot"> block, replace AllowOverride None by AllowOverride All (otherwise your htaccess is disabled) Commented Nov 15, 2014 at 14:47

1 Answer 1

2

Thanks to Justin Iurman Who wrote the following as a comment, witch solved most of it:

In <Directory "/var/www/joppli-bot"> block, replace AllowOverride None by AllowOverride All (otherwise your htaccess is disabled)

I also added DirectoryIndex joppli.bot at the bottom of my .htaccess file to route all trafic from root directory to the script as well..

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.