在URL重写htaccess方面需要帮助

时间:2012-07-18 12:48:08

标签: php .htaccess url-rewriting

大家好,             我需要有关URL重写的帮助我的实际网址为{www.mysub.domain.com/other?Name=Some Product Name&code=12312312}。在.htaccess文件中添加代码后,网址为{www.mysub.domain.com/other/Some Product Name/12312312}。这在我的localhost上工作正常但在我的域名主机上出错。下面是我的代码,查看它,让我知道是错误。我感谢您的帮助。

<pre>
RewriteEngine on<br>
RewriteRule ^itm/([A-Za-z0-9\s+!@$%&*._%+-/\(){}#='"`~|;:<>]+)/([0-9]+)$ itm.php?ItemName=$1&code=$2<br>
</pre>

感谢。

1 个答案:

答案 0 :(得分:0)

尝试使用以下内容:

Options +SymLinksIfOwnerMatch

RewriteEngine on

RewriteRule ^([a-zA-Z-]+)$ index.php?action=$1 [NC,L]

RewriteRule ^(member)-([0-9-]+)$ index.php?action=member&id=$2 [NC,L]

RewriteRule ^([a-zA-Z-]+)/([a-zA-Z-]+)-([0-9-]+)$ index.php?action=$1&saction=$2&sid=$3 [NC,L]

RewriteRule ^([a-zA-Z-]+)/([0-9-]+)$ index.php?action=$1&id=$2 [NC,L]

RewriteRule ^([0-9-]+)/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/(.*).html$ index.php?action=details&id=$1&p1=$2&p2=$3&p3=$4 [NC,L]