views:

18

answers:

1

Hi i got a problem with changing urls. I have files: cat-art.php (cat- category, art- title of an article) and i would like to have nicer access to them: cat/art.php so i wrote some code in .htaccess but it doesnt work.

RewriteCond %{REQUEST_URI} ^/([^-]+)/([^-]+).html$
RewriteRule ^([^-]+)/([^-]+).html$ $1-$2.html [L]

Can sb help me please? Thanks for your help

EDIT:

Changed as rami said and it works but it isn't what i was looking for. it change cat-art.php into cat/art.php and i would like into cat/art.html when i changed it it didnt work.

RewriteRule ^([^-]+)/([^-]+).html$ $1-$2.php [L] - doesnt work
RewriteRule ^([^-]+)/([^-]+).php$ $1-$2.php [L] - works

EDIT2: It works - problems with browser - i deleted history, cookies etc. and now it works in IE FF and Safari

+1  A: 

Of course it does not work - you are redirecting .html files, not .php ;-) And: the RewriteCond statement is useless in this case.

RewriteRule ^([^-]+)/([^-]+).php$ $1-$2.php [L]
rami
is there any possibility to mask php files (cat/art.html -> cat-art.php)? - i use another rule to change php into html but not with cat-art files - that's why i made a mistake thanks
andrewpo
Of corse its possible: RewriteRule ^([^-]+)/([^-]+).html$ $1-$2.php [L]
rami