views:

49

answers:

1

I know this question has been asked a million of times here at stackoverflow, but I cant get it to work so I need someone who knows to finally resolve this problem!

I want that when this is inserted in the URL:

http://website.com/pelicula/0221889/
http://website.com/pelicula/0221889/posters/

It really goes to this:

http://website.com/index.php?ctrl=pelicula&id=0160399
http://website.com/index.php?ctrl=pelicula&id=0160399&tab=posters

This is how my .htacces file looks like:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^/([^/]+)/([^/]+)/?([^/]*)/?$ index.php?ctrl=$1&id=$2&tab=$3 [QSA,L]
</IfModule>

But its not working! I just get a 'Not found' error in my web server (only when using the friendly URL, regular is still working fine). How to fix this?

I would also want to know how to be able to add anything at the end of the URL without getting any errors (like stackoverflow URLs).

Like this:

http://website.com/pelicula/0221889/any-text-i-want-to-put
http://stackoverflow.com/questions/3033407/htacces-to-create-friendly-urls-help-needed

I hope someone can give me an answer, thanks!

A: 

I read all of your threads so I'm not going to reiterate what others have said or asked. I'm just throwing out ideas here but...

Sounds like rewrite is working - it's actually redirecting correctly - but it's pointing you to a page that is not found. Have you tried using RewriteBase?

RewriteEngine On
RewriteBase /
Phillip Harrington
No, I don't really know how to use it. I also noticed that in some cases (using certain mod_rewrite rules, dont remember wich, need to check) its redirects me to the main page (index.php?ctrl=home) but the .css and .js files are not found becouse I'm using relative paths when calling them (I think) Maybe with that info you can help me a little more!
Jonathan