mod_alias in .htaccess

Posted on 2009-04-17
Last Modified: 2012-05-06

I know you're not allowed to have a alias in .htaccess, but I would like, on my hosting server, to create an alias (I use godaddy).  Is there anything I can do about this?
Question by:paulj1999
    LVL 27

    Accepted Solution

    You can test if mod_rewrite is available
    RewriteEngine on
    # rewrite /alias/foo to /folder/foo
    RewriteRule ^alias/(.*) /folder/$1 [L]

    Open in new window


    Author Comment

    Sorry for taking so long to get back to this question.  
    is /folder/$1 an absolute path?  

    For example, if I have my web root pointed to /site/web/ , would the above method work if I wanted to point to /site/leg

    would I do
    RewriteEngine on
    RewriteRule ^leg/(.*) /site/leg/$1 [L]

    LVL 27

    Expert Comment

    > is /folder/$1 an absolute path?  

    No, an URL-path. You can't rewrite outside of the document_root via .htaccess files. What you could do is to create a symlink leg which points to /site/leg/

    Featured Post

    Courses: Start Training Online With Pros, Today

    Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

    Join & Write a Comment

    As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
    If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now