PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, February 17, 2022

[FIXED] CakePhp3 Htaccess

 February 17, 2022     .htaccess, cakephp, php     No comments   

Issue

I want to access image file in this folder by local.myproject/assets/logo.jpg Note that /img/ folder is not in the URL

|-webroot
    |-js
    |-img
       |-assets
           |-logo.jpg

How can i configure this on my htaccess currently my .httacess under webroot is like

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
    RewriteRule ^assets/(.*)$ img/assets/$1 [R=301,L]
</IfModule>

And this is not working.


Solution

Try the following rule :

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^assets(.*)$ /img/assets$1 [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>


Answered By - Hasta Dhana
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing