Answer the question
In order to leave comments, you need to log in
RewriteRule not working?
Goodnight.
At the root of the site is .htaccess with the following content:
AddDefaultCharset UTF-8
RewriteEngine on
#RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
Options -Indexes
http://site.com/storage/images/1.png
should redirect to storage.site.com/images/1.png
RewriteRule ^storage/(.+)$ http://storage.site.com/$1 [R=301,L]
But you can't add it in a way that doesn't break something else. RewriteRule . index.php
, then it does not work. The request is passed to index.php (which is understandable). Answer the question
In order to leave comments, you need to log in
Poked, poked - figured it out.
It was necessary to add a condition for this rule, so that it would not always be fulfilled.
AddDefaultCharset UTF-8
RewriteEngine on
#RewriteBase /
RewriteCond %{REQUEST_URI} ^/storage/(.+)$
RewriteRule ^storage/(.+)$ http://storage.site.com/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
Options -Indexes
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question