2013-11-26 77 views
1

我想重寫以下網址:htaccess的重寫規則例外

http://www.web.de/productCat1 - >無功傳遞到productCat1 productCat.php
http://www.web.de/productCat1/product20 - >通瓦爾productCat1 +無功product20到products.php
http://www.web.de/shop - >做什麼的文件存在
http://www.web.de/contact - >作爲文件存在

到目前爲止,什麼也不做我有這樣的:

Options +FollowSymLinks -MultiViews 
RewriteEngine On 
RewriteBase/ 

# PHP to NO Extension 
RewriteCond %{REQUEST_FILENAME}.php -f 
RewriteCond %{REQUEST_URI} !/$ 
RewriteRule ^(.*)$ $1\.php 

#catch all products 
RewriteCond %{REQUEST_URI} ^/([^/]+/[^/]+)/{0,1}$ 
RewriteRule ^([^/]+/[^/]+)/{0,1}$ /products.php?rw=1&url=$1/$2 [L,QSA] 

#catch all categories 
RewriteCond %{REQUEST_URI} !^/(shop|contact)$ 
RewriteRule ^([^/]+)$ /productCat.php?rw=1&url=$1/$2 [L,QSA] 

經過多次嘗試,我仍然收到500內部服務器錯誤。

回答

0

嘗試:

Options +FollowSymLinks -MultiViews 
RewriteEngine On 
RewriteBase/ 

# PHP to NO Extension 
RewriteCond %{REQUEST_FILENAME}.php -f 
RewriteCond %{REQUEST_URI} !/$ 
RewriteRule ^(.*)$ $1\.php 

#catch all products 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^([^/]+/[^/]+)/?$ /products.php?rw=1&url=$1 [L,QSA] 

# catch all categories 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^([^/]+)/? /productCat.php?rw=1&url=$1 [L,QSA] 
+0

我的服務器上的文件進行了不同的名稱,現在products.php和productCat.php它工作一切優秀謝謝。 –