2017 © Pedro Peláez
 

library phpnet-laravel-trailing-slash

Adds redirection with trailing slash in Laravel.

image

phpnet/phpnet-laravel-trailing-slash

Adds redirection with trailing slash in Laravel.

  • Wednesday, January 10, 2018
  • by PhpNet
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Laravel Trailing Slash

Adds redirection with trailing slash in Laravel., (*1)

Build For Laravel Latest Stable Version Latest Unstable Version Total Downloads License, (*2)

Installation

Step 1: Install package

To get started with Laravel Trailing Slash, use Composer command to add the package to your composer.json project's dependencies:, (*3)

composer require fsasvari/laravel-trailing-slash

Or add it directly by copying next line into composer.json:, (*4)

"fsasvari/laravel-trailing-slash": "0.1.*"

Step 2: Service Provider

After installing the Laravel Trailing Slash library, register the LaravelTrailingSlash\RoutingServiceProvider in your config/app.php configuration file:, (*5)

'providers' => [
    // Application Service Providers...
    // ...

    // Other Service Providers...
    LaravelTrailingSlash\RoutingServiceProvider::class,
    // ...
],

Step 3: .htaccess

Copy following redirection code from public/.htaccess to your own project:, (*6)

<IfModule mod_rewrite.c>
    # Redirect To Trailing Slashes If Not A Folder Or A File...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !(/$|\.)
    RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]
</IfModule>

Step 4: Routes

In routes/web.php, you must use routes with trailing slashes now:, (*7)

Route::get('/', function () {
    return view('welcome');
});

Route::get('about/', function () {
    return view('about');
});

Route::get('contact/', function () {
    return view('contact');
});

Usage

Every time you use some Laravel redirect function, trailing slash ("/") will be applied at the end of url., (*8)

return redirect('about/');

return back()->withInput();

return redirect()->route('text', ['id' => 1]);

return redirect()->action('IndexController@about');

Licence

MIT Licence. Refer to the LICENSE file to get more info., (*9)

Author

Frano Šašvari, (*10)

Email: sasvari.frano@gmail.com, (*11)

The Versions

10/01 2018

dev-master

9999999-dev https://github.com/phpnet/phpnet-laravel-trailing-slash/

Adds redirection with trailing slash in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Serg Serdyuk

laravel php redirect

18/12 2017

v0.1.8

0.1.8.0 https://github.com/fsasvari/laravel-trailing-slash

Adds redirection with trailing slash in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Frano Sasvari

laravel php redirect

01/12 2017

v0.1.7

0.1.7.0 https://github.com/fsasvari/laravel-trailing-slash

Adds redirection with trailing slash in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Frano Sasvari

laravel php redirect

28/07 2017

v0.1.6

0.1.6.0 https://github.com/fsasvari/laravel-trailing-slash

Adds redirection with trailing slash in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Frano Sasvari

laravel php redirect

27/07 2017

v0.1.5

0.1.5.0 https://github.com/fsasvari/laravel-trailing-slash

Adds redirection with trailing slash in Laravel.

  Sources   Download

MIT

The Requires

 

by Frano Sasvari

laravel php redirect