• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
htaccess rewrite assets directory


i have multiple ci instances in different folders, each folder has only 3 files .htaccess index.php and /config/config.php.

only problem i face is assets which is called through base_url('assets/.....'), modifying code is not an option since program developers pushes frequent updates and my changes will be overwritten, what i need to do is make rewrite rule in htaccess which will modify mysite.com/folder/assets to mysite.com/assets. 

i tried lots of combination but none of them works, i think it has something to do with my current htaccess parameters

Original code

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
AddDefaultCharset utf-8

I have added bellow code, but js functions which are adding css parameters doesn't work any more.

 RedirectMatch 301 ^/demo/assets/(.*)$ /assets/$1

Stupid .htaccess Tricks

THE Ultimate Htaccess
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.