FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


need help with mod_rewrite rules





ammonkc
I have a very simple MVC framework that I wrote (mostly by following a tutorial I found online a while ago). I'm trying to make nicer looking URLs by using mod_rewrite rules. This is what I'm trying to do with the url:
Code:

change this:
mydomain.com/index.php?route=controller/action

into this:

mydomain.com/controller/action


Here is the rewrite rules in my .htaccess file:
Code:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?route=$1 [L,QSA]


These rewrite rules seem to work fine with a URL like this: mydomain.com/controller
but as soon as I put a "/" at the end of the controller like this: mydomain.com/controller/ it doesn't load any of my resources like images, css, and javascript files.
this means that I cant add any actions to my controllers if when using the pretty urls.

what do I need to do to my rewrite rules so that it can still find my images, .css/ and .js resource files even with a slash ("/") in the url?[/quote]
Fire Boar
Nothing. All you need to do is include the following in your <head> tag:

<base href="http://mydomain.com/" />
Related topics
Help me, cheat me and earn 10 Frish!
only .htaccess instead of mod_rewrite
Help. Upload an avatar to my perfil
Some help with the Rules and such
Free Domain, With Frihost Members Help!
CALVIN AND HOBBES FANS: need some help again.
Outlook 2007/2003 Help with Contacts please
Can you target a <div> like a frame?
I need help with PHPBB 2 coding
help with mod_rewrite
Apache mod_rewrite
Redirect Problems - 50FRIH reward
Save as .html or .php
.htaccess problem in wordpress
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.