How can I support multiple domains in one htaccess file?

I'm in a hosting environment where I can't modify the Apache conf files directly, so I am relying on htaccess files.

I have a public_html directory and I want to set it up so that I can have subdirectories like the following, so that when visitors access alpha.com in their browsers, they get the content from that directory, and so on:

public_html/alpha.com   # Used when visitors access alpha.com
public_html/bravo.com   # Used when visitors access bravo.com
public_html/charlie.com # Used when visitors access charlie.com

How can I do this with an htaccess file in the root of public_html?

I don't want to use any kind of client-side redirect. I want to map these on the server side.

.htaccess: Rewrite-Rule denys access on .html-files

Using Apache 2.4 I created a Rewrite-Rule with conditions within my .htaccess-file. Right now, it contains the following code:

<IfModule mod_headers.c>
  Header always set Strict-Transport-Security "max-age=15552000"
</IfModule>

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]

ErrorDocument 404 https://example.com/404

When Im - as example - trying to reach example.com/test.html it redirects me to example.com/test, which looks better. The problem is, if im needed to access e.g. a .html-file (when I'm using a setup-process as example) it gives me a (for me) unfixable 403 Permission denied error.

Is there any way of accepting the link to example.com/test and serving example.com/test.html and allowing direct access to example.com/test.html and serving example.com/test.html?

Unable To Start Tomcat 7: NoSuchMethodError getSessionCookieConfig()

I have used Tomcat about two months ago and it started OK. Now I'm getting this message:

SEVERE: ContainerBase.addChild: start: 
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/docs]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1120)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1678)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getSessionCookieConfig()Ljavax/servlet/SessionCookieConfig;
    at org.apache.catalina.deploy.WebXml.configureContext(WebXml.java:1374)
    at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1351)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:376)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5322)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 10 more

Please note the following behavior:

  • I get this error when I attempt to run catalina.bat. If I run Tomcat via Eclipse, it launches successfully

  • I downloaded the same version of Tomcat again and run it immediately without adding any webapps (to simply load the default Tomcat localhost page) but again I get this error.

  • As per previous similar questions, I replaced servlet-api.jar in apache's lib folder, but it has made no difference

I was successfully able to launch startup.bat recently and I don't think anything has changed. Please advise, thanks.

(PHP)Script in Apache works great, but not in IIS

I didn't know wrote what in Title, sorry!
I have this script that I got from MediaDivision for downloading data with header:

<?php
// hide notices
@ini_set('error_reporting', E_ALL & ~ E_NOTICE);

//- turn off compression on the server
@apache_setenv('no-gzip', 1);
@ini_set('zlib.output_compression', 'Off');

//Getting upload center and append file name

$file_path = $_SERVER['DOCUMENT_ROOT'] . $dir_path;
$file_name = pathinfo($file_path)['basename'];

// allow a file to be streamed instead of sent as an attachment
$is_attachment = isset($_REQUEST['stream']) ? false : true;

// make sure the file exists
if (is_file($file_path))
{
    $file_size  = filesize($file_path);
    $file = @fopen($file_path,"rb");
    if ($file)
    {
        // set the headers, prevent caching
        header("Pragma: public");
        header("Expires: -1");
        header("Cache-Control: public, must-revalidate, post-check=0, pre-check=0");
        header("Content-Disposition: inline; filename=\"$file_name\"");
        header("Content-Type: video/x-msvideo");
        if(isset($_SERVER['HTTP_RANGE']))
        {
            list($size_unit, $range_orig) = explode('=', $_SERVER['HTTP_RANGE'], 2);
            if ($size_unit == 'bytes')
            {
                list($range, $extra_ranges) = explode(',', $range_orig, 2);
            }
            else
            {
                $range = '';
                header('HTTP/1.1 416 Requested Range Not Satisfiable');
                exit;
            }
        }
        else
        {
            $range = '';
        }

        //figure out download piece from range (if set)
        list($seek_start, $seek_end) = explode('-', $range, 2);

        //set start and end based on range (if set), else set defaults
        //also check for invalid ranges.
        $seek_end   = (empty($seek_end)) ? ($file_size - 1) : min(abs(intval($seek_end)),($file_size - 1));
        $seek_start = (empty($seek_start) || $seek_end < abs(intval($seek_start))) ? 0 : max(abs(intval($seek_start)),0);

        //Only send partial content header if downloading a piece of the file (IE workaround)
        if ($seek_start > 0 || $seek_end < ($file_size - 1))
        {
            header('HTTP/1.1 206 Partial Content');
            header('Content-Range: bytes '.$seek_start.'-'.$seek_end.'/'.$file_size);
            header('Content-Length: '.($seek_end - $seek_start + 1));
        }
        else
          header("Content-Length: $file_size");

        header('Accept-Ranges: bytes');

        set_time_limit(0);
        fseek($file, $seek_start);

        while(!feof($file)) 
        {
            print(@fread($file, 1024*8));
            ob_flush();
            flush();
            if (connection_status()!=0) 
            {
                @fclose($file);
                exit;
            }           
        }

        // file save was a success
        @fclose($file);
        exit;
    }
    else 
    {
        // file couldn't be opened
        header("HTTP/1.0 500 Internal Server Error");
        exit;
    }
}
else
{
    // file does not exist
    header("HTTP/1.0 404 Not Found");
    exit;
}
?>

This script works great in Linux servers that I tested with. I can resume downloads and get 8 connection in IDM and everything, But is IIS I just get 1 connection and after every pause, I have to wait a few seconds or I get Server Closed Connection.
I have exact php version installed in both servers, And did all the configs that I found in tutorials with Windows Server 2012 and IIS 8.
So what's the problem here?
(Although I have to say that direct download from `Server 2012 has no problem and works great.)

How to install laravel app in subfolder of shared host?

I install laravel app in root of my shared host "public_html now I want to install Russian version of this app in ru/ subfolder but when I go to example.com/ru I got 404 Page not found error. I use apache web server my .htaccess file in root folder contain these code

<IfModule mod_rewrite.c>
   RewriteEngine On 
   RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

how should i change this configuration?

Thanks.

Apache HTTP Server has stopped working (Xampp)

I keep trying to start the Apache server in XAMPP, but it never works. I've tried restarting my computer and it still doesn't work.

I don't have Skype installed, so I don't think anything is taking the port. I am using Windows 7, 32bit. My XAMPP version is 3.2.2.

Problem signature:
  Problem Event Name:   APPCRASH
  Application Name: httpd.exe
  Application Version:  2.4.23.0
  Application Timestamp:    577631b1
  Fault Module Name:    pcre.dll
  Fault Module Version: 0.0.0.0
  Fault Module Timestamp:   5761112c
  Exception Code:   c0000005
  Exception Offset: 00086400
  OS Version:   6.1.7601.2.1.0.256.1
  Locale ID:    1033
  Additional Information 1: 4c0d
  Additional Information 2: 4c0d4d78887f76d971d5d00f1f20a433
  Additional Information 3: 4c0d
  Additional Information 4: 4c0d4d78887f76d971d5d00f1f20a433

When I close the program, I get Error Screenshot.

XAMPP was working fine the first time I used it. But when I tried to run it a day later, it just shows this error in the XAMPP Console.

3:51:32 PM  [Apache]    Error: Apache shutdown unexpectedly.
3:51:32 PM  [Apache]    This may be due to a blocked port, missing dependencies, 
3:51:32 PM  [Apache]    improper privileges, a crash, or a shutdown by another method.
3:51:32 PM  [Apache]    Press the Logs button to view error logs and check
3:51:32 PM  [Apache]    the Windows Event Viewer for more clues
3:51:32 PM  [Apache]    If you need more help, copy and post this
3:51:32 PM  [Apache]    entire log window on the forums

I've seen many solutions, but none of them fix my problem. So expert guys, please help.

.htaccess – create 404 page without .html ending form

I would like to create a default 404 page on my website and I know how I can do it:

ErrorDocument 404 http://example.com/404.html

But how I can create a special redirect to this page from url: "http://example.com/page-not-found" ?? I searched in Google and here but I find nothing about it.

So finally, when user visit page: http://example.com/test-page and this url is not exist on my website, script should redirect user to page: "http://example.com/page-not-found" and this url should present html code from 404.html file.

Thanks.

Search value in the ReplaceText of NiFi does not parse regex being passed through an attribute (even though it supports Expression Language)

I have a simple Apache (nifi) data flow that performs a dynamic regex on a flowfile. The regex is passed in from a file (or from a db). My intention was to build dynamic search and replace functionality using regex capture groups.

When I load a "Search" regex into an attribute and pass that attribute into "Search Value" property of the ReplaceText processor it does NOT perform the search. However, when I enter the regex directly (so not through an attribute) into the "Search Value" property then it works fine. This makes me believe that the "Search Value" property does not support Expression Language (as it claims). Can someone please comment on this or help me out another way to dynamically submit regex statements into the processor ?