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 in their browsers, they get the content from that directory, and so on:

public_html/   # Used when visitors access
public_html/   # Used when visitors access
public_html/ # Used when visitors access

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"

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

ErrorDocument 404

When Im - as example - trying to reach it redirects me to, 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 and serving and allowing direct access to and serving

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(
    at org.apache.catalina.core.ContainerBase.addChildInternal(
    at org.apache.catalina.core.ContainerBase.addChild(
    at org.apache.catalina.core.StandardHost.addChild(
    at org.apache.catalina.startup.HostConfig.deployDirectory(
    at org.apache.catalina.startup.HostConfig$
    at java.util.concurrent.Executors$
    at java.util.concurrent.ThreadPoolExecutor.runWorker(
    at java.util.concurrent.ThreadPoolExecutor$
Caused by: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getSessionCookieConfig()Ljavax/servlet/SessionCookieConfig;
    at org.apache.catalina.deploy.WebXml.configureContext(
    at org.apache.catalina.startup.ContextConfig.webConfig(
    at org.apache.catalina.startup.ContextConfig.configureStart(
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(
    at org.apache.catalina.core.StandardContext.startInternal(
    at org.apache.catalina.util.LifecycleBase.start(
    ... 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:

// 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");
            list($size_unit, $range_orig) = explode('=', $_SERVER['HTTP_RANGE'], 2);
            if ($size_unit == 'bytes')
                list($range, $extra_ranges) = explode(',', $range_orig, 2);
                $range = '';
                header('HTTP/1.1 416 Requested Range Not Satisfiable');
            $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));
          header("Content-Length: $file_size");

        header('Accept-Ranges: bytes');

        fseek($file, $seek_start);

            print(@fread($file, 1024*8));
            if (connection_status()!=0) 

        // file save was a success
        // file couldn't be opened
        header("HTTP/1.0 500 Internal Server Error");
    // file does not exist
    header("HTTP/1.0 404 Not Found");

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 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]

how should i change this configuration?


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:
  Application Timestamp:    577631b1
  Fault Module Name:    pcre.dll
  Fault Module Version:
  Fault Module Timestamp:   5761112c
  Exception Code:   c0000005
  Exception Offset: 00086400
  OS Version:   6.1.7601.
  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

But how I can create a special redirect to this page from url: "" ?? I searched in Google and here but I find nothing about it.

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


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 ?