E
E
Eugene Zalivadnyi2015-10-20 02:48:08
htaccess
Eugene Zalivadnyi, 2015-10-20 02:48:08

How to overwrite path to all files in .htaccess?

I downloaded the backup of the site on Laravel from the hosting to the local machine with OpenServer. Accordingly, the question arose with the paths in the .htaccess file.
The current folder structure is as follows: D:\OpenServer\domains\local.site\web\site.ru\public_html
It is necessary that when entering the main page, which corresponds to the local.site folder, all file paths are taken relative to the \web\site folder. en\public_html.
I assume that you need to use the RewriteRule rule, but I don’t understand how.
I'm trying to do this:

RewriteEngine On
  RewriteCond %{HTTP_HOST} ^local\.site$ [OR]
  RewriteCond %{HTTP_HOST} ^www\.local\.site$
  RewriteCond %{REQUEST_URI} !^/web/site.ru/public_html/
  RewriteRule (.*)   /web/site.ru/public_html/$1

The code renders the page, but does not pull up the paths to styles and scripts.
Inside /web/site.ru/public_html/ there is another .htacces:
php_flag short_open_tag off
<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

How to write the rules correctly so that, for example, pictures are taken from here: /web/site.ru/public_html/img/visa.png
Files in the /web/site.ru/public_html/img/ folder are visible, but the /web/site file itself .ru/public_html/img/visa.png - 404 not found.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question