2012-07-18 168 views
0

大家好, 我需要關於URL重寫的幫助我的實際網址是{www.mysub.domain.com/other?Name=Some Product Name&code=12312312}在.htaccess文件中添加代碼後,網址將是{www.mysub.domain.com/other/Some Product Name/12312312}。這在我的本地主機上正常工作,但在我的域名主機上發生錯誤。下面是我的代碼,查看它並讓我知道是錯誤。我感謝您的幫助。在URL重寫需要幫助htaccess

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

謝謝。

+0

什麼錯誤? – 2012-07-18 12:54:47

+0

請注意,您必須使用空格創建網址! www.mysub.domain.com/other/Some產品名稱/ 12312312。它可能產生錯誤 – Sangar82 2012-07-18 12:55:32

+0

您的生產服務器是否激活了mod_rewrite模塊?你可以知道它使用php_info() – Sangar82 2012-07-18 12:56:21

回答

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]