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
2
votes
1 answer

Configuring apache mod_alias giving Internal server error

I have following configuration for my virtual host ServerAdmin admins@example.com DocumentRoot /home/mydir ServerName mydir.domain.com ErrorLog …
Tornike
  • 1,245
  • 12
  • 35
2
votes
1 answer

How to ensure that Apache always serves a single page via HTTPS?

I would like to redirect all connections from htt_p://www.example.com/abc.html to HTTP_S://www.example.com/abc.html . What mod_alias or mod_rewrite commands would work for this? I've tried: RewriteEngine on RewriteCond %{HTTPS} =off RewriteRule…
BuyTheBid
  • 277
  • 1
  • 3
  • 11
2
votes
1 answer

Apache RedirectMatch issue with relative path

Recently, I upgraded my Apache server from 2.0 to 2.2.24, but I have an issue with RedirectMatch. My old RedirectMatch directive: RedirectMatch ^/abc/abcd /otherurl/someaction In Apache 2.0, if we use HTTPS to access, eg.…
fightf
  • 71
  • 1
  • 4
2
votes
1 answer

Apache - Redirect 301 pdf to pdf with spaces ( binary file )

What I want: To 301 redirect /file_new.pdf to /file new.pdf ( %20 aka space between file and new ) I'm aware that: I can rely on RewriteRule 301 which uses mod_rewrite, using a solution from this thread: @ mod_rewrite with spaces in the urls…
meder omuraliev
  • 183,342
  • 71
  • 393
  • 434
2
votes
2 answers

mod_alias AliasMatch Regex - matching everything in a folder except two patterns?

I'd like to use AliasMatch to create an alias for everything within a folder, except for two (or more) specific regex patterns. For instance the following AliasMatch creates an alias for everything in the 'content' folder: AliasMatch /content(.*)…
Tristan
  • 1,561
  • 3
  • 18
  • 22
1
vote
1 answer

Redirect 301 Transfer to New Domain Output URL is Ugly

I am moving my blog to a new domain. I am trying to do this through .htaccess. While the redirect is okay - the output URL is 'ugly' example in old domain .htaccess file: redirect 301 /archives/2009/06/02/hello-world/…
1
vote
0 answers

Apache mod_alias / .htaccess, headers different on RedirectMatch vs RewriteRule

Do you have any idee why the Authorization header is lost when using RedirectMatch .*service_auth /service/ vs RewriteEngine on RewriteRule ^(.*service_auth)$ /service/ [QSA] With the first one I get 'User-Agent' => 'Jakarta…
satmovi
  • 73
  • 1
  • 8
1
vote
1 answer

.htaccess rule to 301 redirect without parameters

I have a problem with .htaccess rules: I want to redirect this url: /productos/ficha/carretillas-termicas/dx.html To this one: /productos/ficha/carretillas-termicas/grendia-es-serie-fd20-35n3.html I'm using this .htaccess rule: Redirect 301…
1
vote
1 answer

Apache Redirect /api Requests To Directory

I come from a C# MVC background but I am currently working on a PHP project. In C# you can setup decorators to specify the request URL using something along these lines: [HttpGet] [Route("/ControllerName/ActionName")] public string MyAction() { …
David
  • 5,877
  • 3
  • 23
  • 40
1
vote
1 answer

Htaccess redirect only top level URL

I would like to redirect a top level page using htaccess, but not redirect tier pages. Let me explain. I currently have this redirect in place: Redirect 301 /support /donate In summary, I want someone to be redirected to /donate when the visit…
ScoobaSteve
  • 543
  • 1
  • 5
  • 19
1
vote
1 answer

Why htaccess redirect being overruled?

I've got: Redirect 301 /blog/?p=1 http://www.new-site.com/blog/2000/10/myslug/ which works fine, unless followed by: RedirectMatch 301 ^/blog(/)?(.*)$ http://www.new-site.com/blog/$2 I've tried all kinds of versions, including RewriteRule, but…
beej
  • 135
  • 1
  • 9
1
vote
1 answer

.htaccess 301 redirect with exclusion does not work

I try to use a simple 301 redirect from domain1.com/folder/ to domain2.com/ but excluding domain1.com/folder/subfolder I use the following code in .htaccess: RedirectMatch 301 ^/folder/((?!subfolder).*)$ https://domain2.com/$1 but it simply…
Maxim507
  • 13
  • 3
1
vote
1 answer

RedirectMatch without last part of URL

I have this RedirecMatch RedirectMatch 301 ^/en/products/(.*)/(.*)/(.*)$ https://www.example.com/en/collections/$2/ If I visit https://www.example.com/en/products/sofas/greyson/greyson-sofa I'm redirected…
Matteo Boscolo
  • 638
  • 2
  • 8
  • 18
1
vote
1 answer

Apache : mod_rewrite : Redirect URL from abc.com to abc.com/xyz without changing the URL in browser

I have tried different things like below but no luck : Redirect "/" "REPLACE WITH YOUR COMPLETE URL" in virtual host. Redirect permanent "/one" "Replace with your complete URL" in virtual host. Outside Virtual Host: Redirect…
1
vote
1 answer

htaccess redirectMatch all files of a type except a certain one

Say I have a web folder with: /index.html /assets/css/styles.css /assets/images/logo.png /something.html /holdingpage.html /finale.html /folder/somefile.html /else.html /PDFs/something.pdf I want to put in place an htaccess RedirectMatch for this…
Martin
  • 22,212
  • 11
  • 70
  • 132