I want my url’s to look like this: “http://www.example.com/start”,
and not like this: “http://www.example.com/index.php/start”.
That works fine with this code in my .htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1
On one page i have to work with GET-Parameters, the url should look like this:
“http://www.example.com/artists/picasso”,
and not like this:
“http://www.example.com/index.php/artists?artist=picasso”
That’s also possible with the following code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /index.php?/$1
RewriteRule ^artists/(.*)$ /index.php/artists?artist=$1 [L]
Now, the problem with this solution is, that all other url’s now have to end with a slash.
So it has to look like this: “http://www.example.com/start/”,
and not like this: “http://www.example.com/start”
Thanks for your help !
Try changing your rules to:
Mainly, you have a
/$at the end of your pattern:RewriteRule ^(.*)/$ /index.php?/$1which means it has to end with a slash in order to match the pattern. Changing it to(.*?)/?$makes it optional.