Alias files

Discussion in 'Apache' started by jensdah@gmail.com, Jun 18, 2010.

  1. #1
    I need to alias a number of folders to files. I tried to do this:
    Alias /germany/berlin /cgi-bin/dddd.sh/show.pl?id=ber
    Alias /germany /cgi-bin/dddd.sh/show.pl?id=de

    And so on but it didn't work. Syntax check was OK but it just didnt work. Is it possible to do something like that at all?

    I also tried Redirect instead but got other problems:
    Redirect /germany/berlin http://www.ourhost.com:8080/cgi-bin/dddd.sh/show.pl?id=ber
    Redirect /germany http://www.ourhost.com:8080/cgi-bin/dddd.sh/show.pl?id=de

    It just stripped of the 8080 port directive which is very much needed.

    Any ideas or inputs on this. Do I need to get into mod_rewrite?

    Best regards Jens
     
    jensdah@gmail.com, Jun 18, 2010 IP
  2. bvsonline

    bvsonline Peon

    Messages:
    83
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hello jens,

    You have to enable mod_rewrite module in apache and add the rule shown as below in your htaccess file.

    ==========
    Options +FollowSymLinks
    RewriteEngine On

    RewriteBase /<your folder>/

    #redirect everything else to index.php
    RewriteRule !^/*(__|index\.php) index.php%{REQUEST_URI} [L]
    ===========

    Do let me know if you have further issues.
     
    bvsonline, Jun 18, 2010 IP
  3. jensdah@gmail.com

    jensdah@gmail.com Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks,

    but wont that cause a lot of other things to be rewritten? I will have several other files in the root folder apart from those I tried to create as aliases.

    For instance I want to alias (or rewrite or redirect or whatever) folders like
    /germany
    /netherlands
    /great+britain
    etc
    and in those folders I will have several sub-folders (berlin, amsterdam, london, dublin etc).

    But I will also have other files in the root folder :
    /faq.shtml
    /insurances.shtml
    etc
    I wouldnt want to block access to those.



    /Jens
     
    jensdah@gmail.com, Jun 18, 2010 IP