access laravel public folder with a different url code example

Example 1: laravel get public path url

// Path to the project's root folder    
echo base_path();

// Path to the 'app' folder    
echo app_path();        

// Path to the 'public' folder    
echo public_path();

// Path to the 'storage' folder    
echo storage_path();

// Path to the 'storage/app' folder    
echo storage_path('app');

Example 2: public folder get url from laravel iis web config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
        <rules>
            <rule name="Rule 1" stopProcessing="true">
            <match url="^(.*)/$" ignoreCase="false" />
            <action type="Redirect" redirectType="Permanent" url="/{R:1}" />
            </rule>
            <rule name="Rule 2" stopProcessing="true">
            <match url="^" ignoreCase="false" />
            <conditions>
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
            </conditions>
            <action type="Rewrite" url="index.php" />
            </rule>
        </rules>
        </rewrite>
    </system.webServer>
</configuration>

Tags:

Php Example