user1137342
user1137342

Reputation: 31

Simple URL rewriting doesn't work

I've got an URL like this www.mysite.it/indexa.php?pag=azienda and an URL like www.mysite.it/azienda.

I've already read the other question and I've wrote in my .htaccess this

RewriteEngine On
RewriteRule /([a-z]+)/ http://www.mysite.it/indexa.php?pag=$1 [R]

But it doesn't work.

Upvotes: 0

Views: 262

Answers (1)

greut
greut

Reputation: 4363

Your rule /([a-z]+)/ accepts urls like those:

  • /a/
  • /abc/
  • /abcghijk/
  • /abc/def

but not these ones:

  • /a
  • /abc
  • /abcghijk

Do you see the pattern? The trailing slash. Try this:

RewriteRule ^/([a-z]+)/? /indexa.php?pag=$1 [R,QSA]

Upvotes: 2

Related Questions