mardi 10 janvier 2017

Rule for .htaccess file, laravel framework

I am new to the linux and webserver world

I used copy&paste rules for my .htaccess file The framework is laravel and my task is to redirect everything to non-www version of the website

example:

whenever someone hits

http://ift.tt/2j0i667

it should become

http://ift.tt/2jdTZia

but it redirects to only http://example.com

This is my .htaccess file

# Use PHP56 as default
AddHandler application/x-httpd-php56 .php
<IfModule mod_suphp.c>
    suPHP_ConfigPath /opt/php56/lib
</IfModule>
<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    # RewriteCond %{REQUEST_FILENAME} !-d
    # RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...

   Options -MultiViews
   RewriteEngine On

  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^ index.php [L]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
<IfModule mod_security.c>
        SecFilterEngine Off
        SecFilterScanPOST Off
</IfModule>

#force non-www

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

Can someone help write a .htaccess file. Sorry, for my English

Thank you




Aucun commentaire:

Enregistrer un commentaire