Questions tagged [mod-alias]
Maps different parts of a host file system into the document tree and it used for URL redirection
65
questions
16
votes
3
answers
20k
views
apache2.4 mod_rewrite exclude specific alias directroy/uri
I have the following setup on one of my vhosts:
...<VirtualHost *:80>
ServerName cloud.domain.de
ServerAdmin [email protected]
ServerSignature Off
Alias "/.well-known/acme-...
9
votes
2
answers
30k
views
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:
<VirtualHost ...
8
votes
2
answers
30k
views
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 ...
8
votes
4
answers
7k
views
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 ...
6
votes
2
answers
13k
views
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/?...
5
votes
2
answers
9k
views
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:
<Directory />
Options ...
4
votes
1
answer
1k
views
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 ...
4
votes
2
answers
3k
views
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/...
3
votes
2
answers
6k
views
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 ...
3
votes
2
answers
995
views
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 ...
3
votes
1
answer
381
views
Apache ErrorDocument in an alias
I am trying to set a custom error document in an alias.
Alias /f1 "/media/data/www/f1"
<Directory "/media/data/wwww/f1">
AddHandler cgi-script .cgi .pl
...
2
votes
2
answers
25k
views
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 ...
2
votes
1
answer
3k
views
Apache 2.4: mod_alias, mod_rewrite, mod_proxy execution order
I can't find any documentation on Apache vhosts instructions priority / execution order between
mod_alias (Redirect instructions),
mod_rewrite (RewriteRule instructions)
mod_proxy (ProxyPass ...
2
votes
1
answer
702
views
Apache Web Server Aliasing for multiple url giving 404
I am trying to redirect the all the URL starting from /search-engine/* to /var/www/search-engine/dist but the result says not found, I had tried with AliasMatch as shown below
AliasMatch ^/search-...
2
votes
2
answers
2k
views
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/...
2
votes
1
answer
1k
views
Redirect an Apache2 SSL VirtualHost with mod_alias
I want to make sure there aren't any mysterious odd behaviors when redirecting a SSL VirtualHost with mod_alias Redirect as outlined by Apache here.
My code seems to work, but since SSL virtual hosts ...
2
votes
0
answers
774
views
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:...
2
votes
1
answer
778
views
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 ...
1
vote
2
answers
2k
views
Apache 410 Gone instructions not working with mod_alias nor mod_rewrite
Apache 2.2 (on a server running cPanel) seems to be ignoring instructions to return a 410 status.
This happens for both mod_alias's Redirect (using 410 or gone) and mod_rewrite's RewriteRule (using [...
1
vote
1
answer
752
views
I want to add Apache Alias for api (Different users)
First of all i'm a beginner on these issues, sorry for this :) Actually i am a software developer.
I have a project. Many domains connect to Rest Api domain. And all domains locate same server. I ...
1
vote
1
answer
317
views
Efficient 301 redirects in Apache (www to non-www and vice-versa)?
I came across an article titled "Efficient 301 Redirects."
For example, if you are trying to redirect your site from www to non-www domain, the article suggests that when compared to this .htaccess/...
1
vote
3
answers
4k
views
How to redirect multiple domains to "www." with mod_alias "Redirect" directive?
I'm trying to redirect multiple VirtualHosts without a preceeding "www." from one VirtualHost to another, like so:
<VirtualHost *:80>
ServerName example.com
ServerAlias example.org
...
1
vote
1
answer
50
views
Apache AliasMatch with Multiple Subdomains
I have the following virtual hosts:
<VirtualHost *:443>
ServerName article.example.com
AliasMatch "^/(.*)" "/var/www/html/article.php"
</VirtualHost>
<...
1
vote
1
answer
2k
views
Remove leading slash in URLs - Apache
I've been trying to remove the trailing slashes from all URLs. For example, I want the following URLs to redirect:
http://example.com///test -> http://example.com/test
http://example.com//test -&...
1
vote
1
answer
421
views
Use Path Info in conjunction with RewriteRule
I have a legacy application that I want to wrap in a new symfony project. In order to separate things clearly I decided to move the entire legacy application into a folder legacy which lies outside ...
1
vote
1
answer
2k
views
apache alias pages that load relative resources
I am trying to alias a path to a specific file
I tried:
Alias /Console "/console/console.html"
Now going to http://example.com/Console indeed brings console.html.
but any relative resource ...
1
vote
2
answers
2k
views
Stylesheets not loading in mediawiki
I'm trying to set up an internal mediawiki site with version 1.19 on RHEL 6.2 with Apache. On loading any wiki page, Mozilla reports
Error: The stylesheet http_and_ipaddress/mediawiki/load.php?...
1
vote
2
answers
4k
views
How to redirect (or Alias) jump page with Apache
I'm not an Apache expert but need to make a small change to a web server. We are introducing a "jump page" URL that is different from a primary URL (for tracking reasons).
/productA/index.html
/...
1
vote
1
answer
191
views
Apache RedirectMatch not matching double slash
I want to redirect URLs with multiple consecutive slashes (e.g. //) in the path to have only one consecutive slash, e.g.
https://example.com/a//b/c/ → https://example.com/a/b/c/.
My .htaccess file ...
1
vote
1
answer
338
views
How to create alias to url in Apache 2
I have main url like http://apps1.example.com and i want create alias like
http://apps1.example.com/svc-base
in my vhost config
<VirtualHost *:80>
ServerName apps1.example.com
...
1
vote
1
answer
153
views
Redirect French homepage (and only FR home page) to English home page
Using the .htaccess file, I would like to redirect www.example.com/fr/ to www.example.com/ but not other French pages that have the /fr/ root (e.g. www.example.com/fr/page-name)
I've tried using ...
1
vote
1
answer
78
views
2 websites hosted on same domain, 1 needs to look like a subfolder ( /blog)
I bought a VPS for my new project running apache.
On it I have 2 websites on the same domain.
The first one is Ruby on Rails /var/www/html
The second one is Wordpress /var/www/blog
I want Wordpress to ...
1
vote
1
answer
6k
views
How to redirect from one subfolder to a subsubfolder with htaccess
I have this folder structure:
/fonts
/myfont.eot
/myfont.svg
/myfont.ttf
/myfont.woff
/myfont.woff2
/content
/page1
/files
/logo.png
/style.css
/index.html
/page2
...
1
vote
1
answer
425
views
What wrong with RedirectMatch of Apache 2.2 mod_alias?
We use Apache HTTPD server version 2.2.
I try to use RedirectMatch of Apache 2.2 mod_alias without success ( http://httpd.apache.org/docs/2.2/mod/mod_alias.html#redirectmatch)
I need to create rule ...
1
vote
1
answer
810
views
Conditionally serving files from a directory outside of the document root with Apache2
I have inherited a web application written in PHP. The code is not the best and I want to start using the Symfony framework. It will be a gradual migration through several releases so I need the ...
1
vote
1
answer
2k
views
Is it possible to mix Alias and AliasMatch with Apache
I have a generic alias match like:
AliasMatch ^/plugins/([^/]*)/(.*) /usr/share/tuleap/plugins/$1/www/$2
<DirectoryMatch "/usr/share/tuleap/plugins/([^/]*)/www/">
...
</DirectoryMatch>
...
1
vote
2
answers
621
views
Alias or redirect or rewrite
Roundcubemail and Owncloud folders live on the document root but because of the limitations of the Roundcube OwnCloud Plug-in I have to organise the vhosts as below. $rcmail_config['owncloud_url'] ...
1
vote
0
answers
147
views
Apache 2.2 RedirectMatch behaviour in a Directory context?
What is the URL provided to a RedirectMatch in a Directory context? Does Apache remove the part of the URL up to the current directory?
For context, I am trying to write a RedirectMatch in a ...
1
vote
1
answer
140
views
What .htaccess directives do I use to securely redirect www_public to www_my_new_public?
I'm moving a site to a new shared host. I want to have a folder of php includes below the live directory and available to public php pages. What directives should I add to the .htaccess file in ...
0
votes
1
answer
1k
views
Why isn't my apache alias working?
Here's my vhost in apache 2.4:
<VirtualHost *:80>
ServerName mailcatcher.dev
Alias /mailcatcher.dev.png /Users/me/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/mailcatcher-0.5.12/...
0
votes
1
answer
57
views
Apache AliasMatch with Wildcard Not Working As Intended
I am trying map all wildcards for a directory /a/* onto on file article.php using AliasMatch ^/a/(.*) /article.php but without redirecting (I want to keep the url looking the same). But I am getting a ...
0
votes
1
answer
800
views
Apache location overlapping
I'm trying to create an alias to intercept some url to serve from file system directly with Apache 2.4
In my virtualhost, I have: DocumentRoot /var/www/mysubroot
I have a location on "/" in order to ...
0
votes
2
answers
2k
views
Create a case-insensitive apache alias
I am currently using Apache 2.4.4. Now, the problem is that when I am creating alias like
Alias /mysite "D:/MySite"
it doesn't work for http://127.0.0.1/MySite. So how can I make it case insensitive?...
0
votes
3
answers
2k
views
Redirect 301 fails with a path as destination
I'm using a large number of Redirect 301's which are suddenly failing on a new webserver.
We're in pre-production tests on the new webserver, prior to migrating the sites, but some sites are failing ...
0
votes
1
answer
384
views
Remove slash from URL with htaccess redirect
I am using the following directive in my .htaccess file:
RedirectMatch 301 ^/user/(.*)?$ http://$1.example.com/user/$1
to redirect the URL
example.com/user/koko/
but it redirects to http://koko/....
0
votes
1
answer
2k
views
404 Error for Permalinks with Apache Alias and Wordpress
I have scoured several pages, answers and articles in an attempt to correctly configure Apache Alias and Wordpress Permalinks without success.
/var/www/
| - example.com (Custom Web App)
| - blog....
0
votes
1
answer
2k
views
Apache Alias directive - not ignore .htaccess files
When using the Alias directive to map a URL to a directory outside the document root, it seems that the .htaccess files in the document root are not applied to those requests.
For example, if setting ...
0
votes
1
answer
2k
views
Remove double URL encoding on URL
I have a third-party shopping cart set up on my server using PayPal for payments. When a user completes a transaction they are redirected to the URL https://example.com/?target=payment%255freturn&...
0
votes
1
answer
474
views
Have Apache serve static content instead of forwarding it to Plone (++resource++)
I have a Plone-based site, running behind Apache 2.4, which could perform a little better. One idea is to have Apache serve the static parts of the contents, preventing them from being rewritten for ...
0
votes
1
answer
1k
views
mod_alias.c rule to redirect all subdirectories
A mod_alias newbie here.
I found the rewrite rule below somewhere and have been using it to block bots and hackers that hit my site, looking for directories like HNAP1, wp, blog, etc.
And it works ...