Home htaccess redirection works not properly
Reply: 0

htaccess redirection works not properly

Bejkrools
1#
Bejkrools Published in 2018-01-10 07:41:37Z

I wrote htaccess file but it works not properly.

My project catalogs are:

-website/
   |-htaccess (1)
   |-web/
       |-htaccess (2)
       |-assets/
       |-index_dev.php

htaccess (1)

<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteRule ^(.*)$ web/$1 [L,QSA]
</IfModule>

htaccess (2)

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} \.(gif|png|jpe?g|ico|swf|js|css)$ [NC]
    RewriteRule .* - [R=404,L]

    # rewrite assets version to orginal location
    RewriteCond %{REQUEST_URI} assets/([0-9]+)/
    RewriteRule ^assets/([0-9]+)/(.*)$ assets/$2

    RewriteCond %{REQUEST_URI} !\.(gif|png|jpe?g|ico|swf|js|css)$
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index_dev.php?url=$1 [L,QSA]
</IfModule>

My points are

  1. If assets file not exists then showing 404 http code
  2. Removing version in urls like www.website.com/assets/0001/js/script.js
  3. All "not assets" requests redirects to index_dev.php

Isseu apears when I'm calling url like www.website.com instead www.website.com/home. Then I'm getting page

Index of /web

Why third part of second htaccess not works in this case?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.333342 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO