重寫問題 (Rewrite problems)


問題描述

重寫問題 (Rewrite problems)

In my site i have links like that: 

www.mysite.com/loja/product_info/products_id/1301

I simple want to server rewrites it internally to:

www.mysite.com/loja?slug=product_info.php&products_id=1301

Any help will be appreciated 

My .htaccess :

<IfModule mod_rewrite.c>
#Options +FollowSymLinks
RewriteEngine On
RewriteRule ^loja/product_info/products_id/([0-9]+)$ http://www.mysite.com/loja?slug=product_info.php&products_id=$1 [NC,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
#RewriteRule ^loja?slug=.+/([a-z_]+\.php.*)$ $1 [L]
#RewriteRule ^product_info/products_id/([0-9]+)$ loja?slug=product_info.php&products_id=$1 [QSA,L]
#RewriteCond %{QUERY_STRING} ^options\=(.*)$
#RewriteRule ^(.*)-p-(.*).html$ product_info.php?products_id=$2%1

#RewriteRule ^slug/([^/]+)/([^/]+)/([0-9]+)/? ?slug=$1&$2=$3 [QSA,L]
#RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([0-9]+).*$ ?$1=$2&$3=$4 [L]
#RewriteRule ^slug/([^/]+)/products_id/([0-9]+)$ ?slug=$1&products_id=$2 [QSA,L]
#loja?slug=product_info.php&products_id=1308
#RewriteRule ^page/([^/]+)/([^/]+)/([0-9]+)/? /?slug=$1&$2=$3 [QSA,L]

</IfModule>

Thanks !


參考解法

方法 1:

Try this in your .htaccess before any wordpress rules.

RewriteRule ^loja/product_info/products_id/([0-9]+)$ http://www.mysite.com/loja?slug=product_info.php&products_id=$1 [NC,L]

(by user1391670Rob)

參考文件

  1. Rewrite problems (CC BY-SA 3.0/4.0)

#oscommerce #.htaccess #rewrite #wordpress






相關問題

重寫問題 (Rewrite problems)

用於將 OScommerce 網站轉換為 facebook 商店的插件 (plugin for converting OScommerce site to facebook store)

Prestashop 在註冊表單中添加額外字段 (Prestashop Add extra fields to registration form)

無法訪問 oscommerce 中的前端 (Can't access Front end in oscommerce)

如何將重定向添加到 oscommerce 產品頁面 (how add redirect to oscommerce product page)

域和子域之間的不同會話 (Different session between domain and subdomain)

使用會話將整個站點中的循環重定向到移動站點 (Redirect loop in full site to mobile site using session)

osCommerce mysql 導出到 Excel (osCommerce mysql export to Excel)

在 OSCommerce 中更改“主頁”徽標的 URL 目標 (Changing URL destination for "home" logo in OSCommerce)

我怎麼知道 osCommerce 的版本是什麼? (How can i know what is the release of osCommerce?)

301 重定向舊 osCommerce 鏈接的最佳方式 (Best way to 301 redirect old osCommerce links)

Oscommerce語言安裝問題 (Oscommerce language install problem)







留言討論