News:

The "Support Requests" forum is now viewable by guests.

Main Menu

URL Rewriting problems...

Started by Dondavid, March 20, 2006, 08:50:12 AM

Previous topic - Next topic

Dondavid

Hi,

I'd like to use URL Rewriting to point links like this one:
http://www.creersonsite.fr.nf/cours/PHP/sommaire.php
to this:
http://www.creersonsite.fr.nf/index.php?cours=PHP&id=sommaire

So in my .htaccess file I wrote:
RewriteRule ^/cours/PHP/([^/]*)\.php$ /index.php?cours=PHP&id=$1 [L]

but it doesn't work, seems like the variables put in the URL do not exist. And I don't understand why.
Do anyne know why?

Thanks
PS: Sorry my English is not very good.

Dondavid

OOPS, Sorry for multiple post. I don't understand what happened.

Ben

Multiple Posts deleted.

And I'm not the best with .htaccess files, but you can try this:

RewriteRule ^/cours/PHP/([A-Za-z0-9-]*)\.php$ /index.php?cours=PHP&id=$1 [L]

--Ben
Ben@freepgs.com

Dondavid

Thanks for deleting, I feel so stupid...

Your piece of code seems to not work. I must say I don't understand why, and this is drivin' me crazy.
Thanks for your suggestion anyway...

webzone (archived)

The RewriteRule is not applied because the request doesn't match the pattern. Patterns never match if they start with a /.

This one should work, however:
RewriteRule ^cours/(PHP)/([^/]*)\.php$ index.php?cours=$1&id=$2 [L]

Dondavid

Ok, I didn't know that. Your piece of code doesn't work too.
I really begin to wonder if it's possible.

Dondavid

Problem Solved!!!!!!!
The correct rule is:
RewriteRule ^cours/(PHP|JS|XHTML|CSS)/(.+)\.(php|html)$ index.php?cours=$1&id=$2 [L]

Don't ask me why I don't know. (lol)

thanks to all who tried.