简体   繁体   English

简单的URL重写不起作用

[英]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 . 我有一个像www.mysite.it/indexa.php?pag=azienda的网址和一个像www.mysite.it/azienda这样的网址。

I've already read the other question and I've wrote in my .htaccess this 我已经阅读了另一个问题,我已经在我的.htaccess写了这个

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

But it doesn't work. 但它不起作用。

Your rule /([az]+)/ accepts urls like those: 您的规则/([az]+)/接受以下网址:

  • /a/ /一种/
  • /abc/ / ABC /
  • /abcghijk/ / abcghijk /
  • /abc/def / ABC / DEF

but not these ones: 但不是这些:

  • /a /一种
  • /abc / ABC
  • /abcghijk / abcghijk

Do you see the pattern? 你看到了这种模式吗? The trailing slash. 尾随斜线。 Try this: 尝试这个:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM