Home htaccess redirection works not properly
Reply: 0

htaccess redirection works not properly

user1525 Published in June 25, 2018, 8:03 am

I wrote htaccess file but it works not properly.

My project catalogs are:

   |-htaccess (1)
       |-htaccess (2)

htaccess (1)

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

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]

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.319639 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO