1

How can I implement an alias in .htaccess in Apache configuration? Thank U)

Alias /static "/var/www/core/static" 
<Location "/static"> 
 SetHandler None #
</Location>
asked Jan 4, 2015 at 17:05

1 Answer 1

4

You can't use Alias in an htaccess file. You can do something similar using mod_rewrite but you can not alias to a folder outside of the document root. That means, in your example, if /var/www/core/static isn't in your document root, then you can't link to it. The htaccess file is a "per directory" context, and has no way of knowing anything that is outside of the document root.

The mod_rewrite way works something like this:

RewriteEngine On
RewriteRule ^static/(.*)$ /core/static [L]

Assuming that /core/static is inside your document root. If not, there's nothing you can do with an htaccess file.

answered Jan 4, 2015 at 17:13
Sign up to request clarification or add additional context in comments.

1 Comment

/var/www/ root is a directory, but the record type is not working <link rel="stylesheet" href="/static/entry_panel/styles.css">

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.