Questions tagged [mod-alias]

Apache module providing namespace configuration & redirection.

mod_alias is an Apache HTTP Server module that provides mechanisms to map URL paths to directories on the filesystem or external (browser-based) redirections to other URLs.

211 questions
32
votes
7 answers

Alias 403 Forbidden with Apache

I'm trying to create a folder named week7 and an html page named hello.html in that folder outside the document root and have it viewed through an Alias directive. I created a folder named week7 out of the Document Root. I chose this location for…
Yousif
  • 355
  • 1
  • 3
  • 8
26
votes
2 answers

mod_rewrite or mod_alias?

I have a server, its httpd.conf already has some "RedirectMatch permanent" directives in it. I'm not that familiar with mod_alias, I've only ever used mod_rewrite. What's the basic difference? I don't see a "L" flag in mod_alias to stop processing…
jeph perro
  • 6,242
  • 26
  • 90
  • 124
11
votes
2 answers

Apache alias virtual host

I have two applications running in the same server and I would like to have one served from subpath in the url (i.e): foo.com -> /var/www/foo foo.com/bar -> /var/www/bar I'm trying to do an alias but is not working:
Rafael
  • 614
  • 2
  • 7
  • 13
10
votes
3 answers

Using RedirectMatch with HTTP_HOST in the destination

I keep reading that, where possible, I should not be using mod_rewrite. As such, I am trying to do a http to https rewrite with RedirectMatch. Question: How can I use RedirectMatch and use Apache server variables (such as %{HTTP_HOST}) in the URL…
Tom17
  • 406
  • 5
  • 18
9
votes
2 answers

Apache mod_alias RedirectMatch everything except specific pattern

Good old regular expressions are driving me nuts. I need to redirect all traffic in Apache 2.4 from HTTP to HTTPS, except for "/bt/sub/[a_few_endings]", using Redirect from mod_alias (can't use mod_rewrite). I tested the following regular expression…
borfast
  • 2,194
  • 1
  • 15
  • 34
8
votes
1 answer

Using mod_rewrite and mod_alias (redirect 301) together in .htaccess?

I have a site with a set of old .html and .php pages that have been put into a CMS. Currently in the .htaccess file there are about 30 mod_alias redirects in the following form: redirect 301 /oldpage1.html…
Nick Evans
  • 3,279
  • 2
  • 25
  • 21
7
votes
1 answer

Strip parent categories from url

I'm struggling to fix an issue with 301 redirects and .htaccess. I have moved a site from an old domain to a new domain. And I have successfully managed to do this with a 301 redirect. Like so: Redirect 301 / https://newdomain.com On the old site…
noelmcg
  • 1,057
  • 3
  • 21
  • 44
7
votes
1 answer

Why double slash dot (ie: \\.) in htaccess regex?

From another answer, this double slash dot is common RedirectMatch 404 /\\.svn(/|$) Since we're matching "/.svn" etc., why isn't this a single slash to escape the period?
Eric
  • 83
  • 5
7
votes
2 answers

Rewrite an Alias directory

I'm trying to first use an Alias folder to store my project files in a different location than my DocumentRoot, and then execute a mod_rewrite on this request. However it doesn't seem to parse the .htaccess file. This is the content of my Alias…
TJHeuvel
  • 12,403
  • 4
  • 37
  • 46
5
votes
1 answer

Using Alias in Apache ONLY if local directory not present?

We're running a reseller web host, and aliasing a particular directory for ALL the sites within. This is all happening through WHM/Cpanel, which could possibly complicate my question. We want all hosts to run their "/concrete" directory through a…
Andrew E.
  • 51
  • 2
4
votes
4 answers

How to use htaccess to redirect all but one subdirectory

It's been a while since I've messed with .htaccess and I can't seem to get this quite right. I have a site, say example.com, where I want example.com/* to redirect to example.com/collector.html except for URLs under the subdirectory…
Tyler McHenry
  • 74,820
  • 18
  • 121
  • 166
4
votes
1 answer

Apache : How to Use Rewrite Engine Inside Alias

I have this alias configuration: Alias /test/ "D:/WWW/Test/" Order allow,deny Allow from all Then inside D:/WWW/Test/ directory, I put .htaccess with the following configuration:
Fitrah M
  • 983
  • 3
  • 17
  • 31
4
votes
1 answer

Apache ErrorDocument absolute path

I'm trying to use the same 404 ErrorDocument for a domain and all its subdomains, The subdomains all have their own directory in the /var/www/ path the Apache ErrorDocument directive expects a relative path (relative to the current directory) but I…
Mervin
  • 1,103
  • 4
  • 18
  • 26
3
votes
2 answers

Set apache redirect from http to https for a specific url

I would like to redirect any URL path that is having a /test to https://localhost/test. Also, if an url is /test?user=123 it has to be redirected to https://localhost/test?user=123 or rather if the url is /test/test_db/user?id=123&pwd=123 has to be…
Abhishek
  • 6,862
  • 22
  • 62
  • 79
3
votes
7 answers

How do I use .htaccess to redirect to a URL containing HTTP_HOST?

Problem I need to redirect some short convenience URLs to longer actual URLs. The site in question uses a set of subdomains to identify a set of development or live versions. I would like the URL to which certain requests are redirected to include…
Jon Cram
  • 16,609
  • 24
  • 76
  • 107
1
2 3
14 15