我尝试使用.httaccess重写URL,但失败了

时间:2019-09-18 08:57:18

标签: php .htaccess url redirect cpanel

使用.httaccess进行网址重写,我尝试了几次但是失败了

我正在尝试显示我的网址

WITH AllSuppliers AS
(
SELECT Code, Supplier, 1 AS TablePriority FROM Suppliers
UNION ALL
SELECT Code, Supplier, 2 AS TablePriority FROM tempSupplier
),
SuppliersRanked AS
(
SELECT Code, Supplier,
    ROW_NUMBER() OVER (PARTITION BY Code ORDER BY TablePriority) AS RowPriority
FROM AllSuppliers
)
SELECT DISTINCT SP.*, COALESCE(P.Product, PD.Product) 'Product', S.Supplier
FROM tempsupplierproduct SP
LEFT JOIN tempProduct P ON SP.ProductCode = P.Code
LEFT JOIN Products PD ON SP.ProductCode = PD.Code
LEFT JOIN SuppliersRanked S ON SP.SupplierCode = S.Code
    AND RowPriority = 1

已插入

https://codingeek.net/preview/html/banting-university

我尝试使用此

https://codingeek.net/preview/index.php?tslug=banting-university&cat=html

1 个答案:

答案 0 :(得分:0)

请替换为htaccess

RewriteRule  ^preview/(.+)$  /preview/index.php?tslug=$1&cat=$2   [QSA,L]

RewriteRule  ^preview/(.+)/(.+)$  /preview/index.php?tslug=$2&cat=$1   [QSA,L]