开发者

Friendly URLs with .htacces NOT working... and stackoverflow URLs style

开发者 https://www.devze.com 2023-01-03 11:23 出处:网络
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 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!


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 /
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号