I wish to have these pretty urls:
- Overview of all categories: localhost/category
- Form to make new category: localhost/category/new
- Form to edit category: localhost/category/edit/4
Since I'm working with the Command pattern in my Controller I have these actions in my processRequest in my Controller I have these ugly urls:
- localhost/index.php?action=categoryOverview
- localhost/index.php?action=categoryNew
- localhost/index.php?action=categoryNew&id=4
I'm trying this with .htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-zA-Z]+)/([0-9]*) index.php?action=$1&id=$2
But this doesn't work + my CSS is not loading. I tried these:
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="/css/bootstrap.css">
<link rel="stylesheet" href="css/bootstrap.css/">
<link rel="stylesheet" href="/css/bootstrap.css/">
Could you please help me how
- these pretty urls are done correctly?
- to have the css appear?
Try to use the Conditions:
instead of
So apache will try to find directories (-d) and symbolic links (-l) before passing the url to the controller.