So I've got a strange server set-up that we do not have lots of treatments for. My production site appears like this:

/www/users/name    <- server points here
    /public    <- I want it to point here, but I don't have that option
        index.php    <- all requests should eventually end up here

This is often utilized via world wide AND world wide

My dev site appears like this:

/www/name/public    <- dev server points here
    index.php    <- all requests should eventually end up here

This really is only utilized via world wide

I am utilizing a PHP Framework which forces my web addresses to continually have a similar base to be able to work (Laravel). So world wide works, but world wide won't work. I'd like my web addresses to continually appear because the former to obtain for this problem.

I produced b .htaccess apply for my production base directory that will always toward the general public directory such as this:

    RewriteEngine on

    RewriteRule ^(.*)$ public/$1

The general public directory includes a .htaccess file such as this which included the framework I am using (which I must not change since my dev site works all right by using it):

    RewriteEngine on

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule ^(.*)$ index.php/$1 [L]

With only this, all /~title demands work perfectly, but no /customers/title work. How do you fix my production base directory .htaccess file to pressure all demands from /customers/title to /~title?

I've attempted adding:

RedirectMatch ^/users/name/(.*)$ /~name/$1

Which doesn't work since the rewrites are revealed. For instance, basically request world wide, this turns up as world wide With no RedirectMatch line, all ~title demands work perfectly fine.

Strangely enough, basically swap the rule above to:

RedirectMatch ^/~name/(.*)$ /users/name/$1

Everything works perfect with the exception that my web addresses will invariably have /customers/title rather than /~title like I'd prefer.

Clearly, I'm prepared to accept this if things i request isn't feasible. If a person could explain why the above mentioned works however the prior you don't that might be nice too. Used to do discover that I possibly could get the first ones to work with the addition of RedirectBase /~title to BOTH .htaccess files, but when i pointed out above, I must not alter the public .htaccess file since both my dev and production conditions utilize it.

Thanks ahead of time!

The next works best for me:

RewriteEngine on

RewriteBase /~name    

RewriteCond %{REQUEST_URI} /users/name(.*)
RewriteRule ^(.*)$ $1 [L,R]

RewriteRule ^(.*)$ public/$1

Still unsure why this works and things i referred to above does not... Speculation: I suppose it has something related to once the redirect happens from RedirectMatch. Within this version, I'm forcing the redirect from /customers/title to /~title to continually happen first, before every other rewrites happen. In my opinion the redirect from RedirectMatch above was happening following the other Rewrites that was why the rewrites made an appearance within the address bar. I additionally believe that the Redirect within the other way labored fine because there's probably an Alias for /~title towards the actual path /customers/title. Therefore it needs to replace /~title with /customers/title in a single situation although not another.