Created
          March 13, 2024 07:59 
        
      - 
      
 - 
        
Save arvindsvt/ff7336c9e4a2683e48082a25b0bc771d to your computer and use it in GitHub Desktop.  
    laravel-remove-public-from-url-using-htaccess
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | From : https://www.devopsschool.com/blog/laravel-remove-public-from-url-using-htaccess/ | |
| <IfModule mod_rewrite.c> | |
| <IfModule mod_negotiation.c> | |
| Options -MultiViews -Indexes | |
| </IfModule> | |
| RewriteEngine On | |
| # Handle Authorization Header | |
| RewriteCond %{HTTP:Authorization} . | |
| RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] | |
| # Redirect Trailing Slashes If Not A Folder... | |
| RewriteCond %{REQUEST_FILENAME} !-d | |
| RewriteCond %{REQUEST_URI} (.+)/$ | |
| RewriteRule ^ %1 [L,R=301] | |
| # Handle Front Controller... | |
| RewriteCond %{REQUEST_FILENAME} !-d | |
| RewriteCond %{REQUEST_FILENAME} !-f | |
| RewriteRule ^ index.php [L] | |
| </IfModule> | |
| Options -MultiViews -Indexes | |
| RewriteEngine On | |
| # Handle Authorization Header | |
| RewriteCond %{HTTP:Authorization} . | |
| RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] | |
| # Redirect Trailing Slashes If Not A Folder... | |
| RewriteCond %{REQUEST_FILENAME} !-d | |
| RewriteCond %{REQUEST_URI} (.+)/$ | |
| RewriteRule ^ %1 [L,R=301] | |
| # Handle Front Controller... | |
| RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.gif|robots\.txt)$ [NC] | |
| RewriteCond %{REQUEST_FILENAME} !-d | |
| RewriteCond %{REQUEST_FILENAME} !-f | |
| RewriteRule ^ index.php [L] | |
| RewriteCond %{REQUEST_FILENAME} !-d | |
| RewriteCond %{REQUEST_FILENAME} !-f | |
| RewriteCond %{REQUEST_URI} !^/public/ | |
| RewriteRule ^(css|js|images|trainer-cv)/(.*)$ public/$1/$2 [L,NC] | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment