Categories

What you will be able to do here?

Latest Posts

Remove Public from Laravel URL
  1. Rename server.php file to index.php file at laravel root
  2. Copy the .htaccess from public folder to root folder
  3. Replace .htaccess content that copied in 2nd step as follows


<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </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_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 ^(admin|css|js|images|uploads)/(.*)$ public/$1/$2 [L,NC]
</IfModule>

Add new folder or file extensions as required in your project!

Convert Array to String in PHP

implode(separator,Array) is used to convert Array to String in PHP Language

$array = array('Red','Green','Orange');
$string= implode(",",$array);

Output will Be like Below

"Red,Green,Orange";

Convert String to Array in PHP

explode(separator,String) is used to convert String to Array in PHP Language

string = "Red,Green,Orange";
$array = explode(",",$string);

Output will Be like Below

array([0]=>Red,[1]=>Green,[2]=Orange)