簡體   English   中英

htaccess問題-從漂亮的網址重定向到php版本

[英]Htaccess issues - Redirecting from pretty url to php version

我不是新開發人員,並且與.htaccess已有多年合作,但是今天我完全陷入困境,不知道發生了什么。 以下是我完整的htaccess文件:

Options All -Indexes

ReWriteEngine On

RewriteRule ^page/([a-zA-Z0-9_-]+)$ page.php?pageurl=$1
RewriteRule ^([a-zA-Z0-9_-]+)$ category.php?categoryurl=$1
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([0-9]+)-([a-zA-Z0-9_-]+)$ product.php?category=$1&subcategory=$2&productid=$3&producturl=$4


RewriteCond %{HTTP_HOST} www.website\.com$ [NC]
RewriteRule ^(.*)$ http://website.com/$1 [R=301,L]

website.com/category應該將我帶到它所做的類別頁面,但是由於某種原因,URL被更改了,好像htaccess反向運行一樣,我被發送到website.com/category.php?categoryurl=category。

這與其他頁面完全相同,我的產品頁面應為website.com/category/subcategory/123-producturl,但它也會重定向:

website.com/product.php/category/123-producturl?category=category&subcategory=subcategory&productid=123&producturl=producturl

有人根本不知道為什么這樣做了嗎?

嘗試這一操作,您尚未添加標志來結束HTACCESS中的行。

Options All -Indexes

ReWriteEngine On

RewriteRule ^page/([a-zA-Z0-9_-]+)$ page.php?pageurl=$1 [L]
RewriteRule ^([a-zA-Z0-9_-]+)$ category.php?categoryurl=$1 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([0-9]+)-([a-zA-Z0-9_-]+)$ product.php?category=$1&subcategory=$2&productid=$3&producturl=$4 [L]


RewriteCond %{HTTP_HOST} www.website\.com$ [NC]
RewriteRule ^(.*)$ http://website.com/$1 [R=301,L]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM