Emir Posted February 13, 2008 Share Posted February 13, 2008 Hello, I have having a bit of trouble getting my images to display properly when using a MVC system with mod_rewrite. I have the following in a .htaccess file: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?route=$1 [L,QSA] For the most part it works just as I want: If I type in 'http://www.mysitehere.com/users/login/' it would interpret the request as 'http://www.mysitehere.com/index.php?route=users/login'; however, the trouble I have is that now my images link to something like 'http://www.mysitehere.com/users/login/images/logo.gif'. It should be something like 'http://www.mysitehere.com/images/logo.gif'. Anyone have any ideas how I can use mod_rewrite to correct this as well? Any other method would be greatly appreciated as well. Thank you for your time! Emir Quote Link to comment https://forums.phpfreaks.com/topic/90804-mvc-image-paths-and-mod_rewrite-trouble/ Share on other sites More sharing options...
Emir Posted February 13, 2008 Author Share Posted February 13, 2008 Hey everyone, Looks like I was finally able to figure out what to do. I was able to fix everything with a couple RewriteRule statements. RewriteRule ^[a-zA-Z/]*/images/(.*)$ images/$1 RewriteRule ^[a-zA-Z/]*/includes/(.*)$ includes/$1 That pretty much fixed everything for the image, css, etc links. Thanks for looking though. Maybe someone else might find this useful? Emir Quote Link to comment https://forums.phpfreaks.com/topic/90804-mvc-image-paths-and-mod_rewrite-trouble/#findComment-465496 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.