Maps different parts of a host file system into the document tree and it used for URL redirection
Questions tagged [mod-alias]
63 questions
16
votes
3 answers
apache2.4 mod_rewrite exclude specific alias directroy/uri
I have the following setup on one of my vhosts:
...
ServerName cloud.domain.de
ServerAdmin webmaster@domain.de
ServerSignature Off
Alias "/.well-known/acme-challenge"…
FleBeling
- 163
- 1
- 1
- 5
9
votes
2 answers
How can I redirect any ServerAlias to the respective ServerName?
I want to 301 redirect all example.org to www.example.org. The following example is doing just that, but it's got a lot of noise to it and is thus hard to maintain and error prone:
ServerName example.org
…
user569825
- 331
- 3
- 5
- 12
8
votes
4 answers
Global Apache Alias, ignoring virtual hosts
I have a global entry
Alias /.well-known/acme-challenge /var/www/letsencrypt/.well-known/acme-challenge/
in my apache configuration, outside any virtual host. This way, the above Alias is effective for all virtual hosts. Unfortunately, there are…
Joachim Breitner
- 3,469
- 3
- 17
- 20
7
votes
2 answers
How to check if mod_alias is enabled?
I want to try mod_alias instead of mod_rewrite for a couple of simple redirect rules, but the directives don't seem to be working when entered in .htaccess. Is it possible that mod_alias is not loaded or enabled on the server?
How do I find out?
Knocks X
- 189
- 1
- 2
- 8
6
votes
2 answers
RedirectMatch and Query String
Compare these two RedirectMatch's. The first doesn't work:
RedirectMatch 302 ^/redirect\.php[?]page=(.+)$ http://somewhereelse.com/$1
Versus this, which will redirect to http://somewhereelse.com/?page=wherever:
RedirectMatch 302…
nate
- 207
- 1
- 3
- 9
5
votes
2 answers
apache2 - how to exclude alias from rewrite rules?
I have setup mod_rewrite and mod_alias on Apache2 on Debian (in a test server).
I have the following rewrite code in /etc/apache2/sites-available/default:
Options FollowSymLinks
AllowOverride All
RewriteEngine on
RewriteCond…
James Nine
- 173
- 1
- 7
4
votes
2 answers
Can I use Apache variables with mod_alias's `Redirect`, instead of using mod_rewrite?
The Apache HTTP Server's mod_alias provides the Redirect directive which is great for simple redirects, like the following:
# Redirect login to https
Redirect permanent /login https://www.example.org/login
While many admins use mod_rewrite for…
Stefan Lasiewski
- 22,949
- 38
- 129
- 184
3
votes
1 answer
How can I force RedirectMatch not to escape the redirect URL
Today I've noticed that mod_alias's Redirect and RedirectMatch directives show a different behavior in how they handle the redirect URL.
A statement like this:
Redirect 301 "/foo" "/bar%20baz"
will redirect to the literal URL bar%20baz,…
dorian
- 397
- 1
- 7
- 22
3
votes
2 answers
How would you replace this rewrite rule with a redirect?
This Apache reference page and this wiki clearly states that to achieve simple http to https redirects, mod_alias should be used instead of the more expensive mod_rewrite.
I have an Apache virtualhost which uses a wildcard to match multiple…
Anjan
- 277
- 1
- 2
- 14
3
votes
1 answer
Apache ErrorDocument in an alias
I am trying to set a custom error document in an alias.
Alias /f1 "/media/data/www/f1"
AddHandler cgi-script .cgi .pl
Options Includes Indexes MultiViews FollowSymLinks ExecCGI
AllowOverride…
Lord Loh.
- 1,049
- 3
- 15
- 24
2
votes
0 answers
mod_rewrite over mod_alias / Ordering and precedence
Within a multi-server shared hosting I am using this
RedirectMatch temp "/.well-known/acme-challenge/(.*)" "https://FOO.BAR.TLD/$1"
to redirect all Let's Encrypt requests to one server.
The problem: If someone (customer ;-) ) is using…
Schubi Duah
- 51
- 1
2
votes
2 answers
Serving multiple directories outside of web root from the same URL with Apache2
Is it possible to set up Apache to serve multiple directories from the same URL?
For example, given that I have images in two locations: /mnt/imagestore1, /mnt/imagestore2. I would like mysite.com/images/file.jpg to display images from either…
Matt Brunmeier
- 151
- 6
2
votes
2 answers
Redirect wildcard subdomain to same subdomain on different domain
I have a domain with dynamic subdomains. The domain, unfortunately, has changed. As such I need to redirect
*.domain1.com
to
*.domain2.com
while keeping the subdomains the same. I have looked through the mod_alias and mod_rewrite documentation…
Joseph
- 141
- 1
- 7
2
votes
2 answers
The Alias directive will probably never match because it overlaps an earlier Alias
Ok, not sure why this is occuring.
So, I get the message
The Alias directive in /etc/httpd/conf.d/awstats.conf at line 3 will probably never match because it overlaps an earlier Alias.
and
The Alias directive in /etc/httpd/conf.d/welcome.conf at…
fizzy drink
- 375
- 4
- 8
- 22
2
votes
1 answer
Apache: Serving same file on multiple vhosts using regex
I have various virtual hosts (vhosts) setup on an Apache 2.2 server such as:
examplea.domain
exampleb.domain
testsitea.domain
testsiteb.domain
testsite.domain
othersitea.domain
On virtual hosts matching the regular expression "site[a-z].domain", I…
Richy B.
- 213
- 1
- 6