Search code examples
apache.htaccessmod-rewritehttp-redirectlimesurvey

URL redirect not working with .htaccess not working


I am trying to provide better URLs to couple of the Surveys which I have hosted in my server.

So here is what I did.

  • In the /var/www directory of the server, (in the same location of index.php file resides), I created a file .htaccess.
  • Below is the content of the .htaccess file:

    RewriteEngine On
    RewriteRule goodURL BadURL
    Redirect goodURL BadURL
    

Please note that goodURL (midnightsun.hiit.fi/socialnetworking) is something which does not exist, where as BadURL(midnightsun.hiit.fi/limesurvey/index.php/755819) is something that exists.

The reason I want to change this URL redirect is to provide good URLs.

Debian GNU/Linux 7.6 (wheezy) is the OS on the server. It is Apache2.

Can any one help me with this?


Solution

  • Redirect temp /liliurl http://example.org/index.php/755819
    
    <IfModule mod_rewrite.c>
        RewriteEngine on
    
        # if a directory or a file exists, use it directly
        RewriteCond %{REQUEST_FILENAME} !-f
    
        # otherwise forward it to index.php
        RewriteRule . index.php
    </IfModule>
    # General setting to properly handle LimeSurvey paths
    # AcceptPathInfo on