1

I have url public/l/img/logo.png and i want to look at public/img/logo.png using htaccess in my public directory.

I tried using this but it doesn't work

RewriteRule ^l/(.*)$ $1 [R=301,L]

My present htaccess

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

and my public is real directory Thanks in advance

mask man
  • 351
  • 2
  • 11
  • By "public is real directory" you actually mean it's the DOCUMENT_ROOT? See also [Tips for debugging .htaccess rewrite rules](http://stackoverflow.com/q/9153262) – mario Jul 28 '15 at 12:28

1 Answers1

2

Case 1: If public is a real directory then use this rule in /public/.htaccess:

RewriteEngine On
RewriteBase /user/public/

RewriteRule ^l/(.+)$ $1 [NC,L]

Case 2: If public is a NOT a real directory then use this rule in root .htaccess:

RewriteEngine On
RewriteBase /

RewriteRule ^user/public/l/(.+)$ public/$1 [NC,L]
anubhava
  • 761,203
  • 64
  • 569
  • 643